577 - DS Practice 3 Scoreboard

Time

2014/03/11 21:30:00 2014/03/11 23:59:59

Clarification

# Problem Asker Description Reply Replier Reply Time For all team

# Problem Pass Rate (passed user / total user)
5716 Sparse Matrix

5716 - Sparse Matrix   

Description

Implement the Addition and Subtraction operations for Sparse Matrix data structure.

—Sparse Matrix means only store the non-zero entries.

—The Sparse Matrix data structure  uses triple to characterize an element in the matrix.

—In each test data contains two Sparse Matrixes.

—You have to use the same data structure to output the result of Addition and Subtraction.

Input

Input data contains two Sparse Matrixes.

Each one is represented by Sparse Matrix data structure.
 
Each Sparse Matrix is a nxm matrix with k non-zero entries.
 
n is the number of rows. 1≤n≤1000000
 
m is the number of columns. 1≤m≤1000000
 
k is the number of non-zero entries. 1≤k≤10000

Output

Output data need contains two Sparse Matrixes.

One is the result of Addition and the other one is the  result of Subtraction. 
 
They need to be represented by Sparse Matrix data structure.
 

Sample Input  Download

Sample Output  Download

Tags




Discuss