Matrix
Time limit:3000/1500 MS (java/others) Memory limit:131072/131072 K (java/others)
Total submission (s): 1021 Accepted Submission (s): 425
Problem Description There is a matrix M which has n rows and M columns (1≤n≤1000,1≤m≤1000). Then we perform q (1≤q≤100,000) operations:
1 x y:swap row x and Row y (1≤x,y≤n);
2 x y:swap column x and column y (1≤x,y≤m);
3 x y:add y to all elements in row x (1≤x≤n,1≤y≤10,000);
4 x y:add y to all elements in column x (1≤x≤m,1≤y≤10,000);
Input There is multiple test cases. The first line of input contains an integer T (1≤t≤20) indicating the number of test cases. For each test case:
The first line contains three integers n, m and Q.
The following n lines describe the matrix M. (1≤mi,j≤10,000) for All (1≤i≤n,1≤j≤m).
The following q lines contains three integers a (1≤a≤4), X and Y.
Output for each test case, output of the matrix M after all Q operations.
Sample Input
2 3 4 2 1 2 3 4 2 3 4 5 3 4 5 6 1 1 2 3 1 10 2 2 2 1 10 10 1 1 1 2 2 1 2
Sample Output
1 2 3 4 3 4 5 6 1 ten 1 Hint recommand to use scanf and printf problem description
There is an nn row mm column matrix (1 \leq n \leq, 1 \leq m \leq 1000) (1≤n≤1000,1≤m≤1000), on this matrix QQ (1 \leq q \leq 100,000) (1≤q≤100,00 0) Operation:
1 x y: The first xx line of the switch matrix mm and the yy line (1 \leq x, y \leq N) (1≤x,y≤n);
2 x y: Column xx and section of the switch matrix mm