F.A.Q
Hand In Hand
Online Acmers
Problem Archive
Realtime Judge Status
Authors Ranklist
 
     C/C++/Java Exams     
ACM Steps
Go to Job
Contest LiveCast
ICPC@China
Best Coder beta
VIP | STD Contests
    DIY | Web-DIY beta
Author ID 
Password 
 Register new ID

Matrix

Time Limit: 3000/1500 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Others)
Total Submission(s): 2645    Accepted Submission(s): 920


Problem Description
There is a matrix $M$ that has $n$ rows and $m$ columns $(1 \leq n \leq 1000 ,1 \leq m \leq 1000 )$.Then we perform $q (1 \leq q \leq 100,000)$ operations:

1 x y: Swap row x and row y $(1 \leq x,y \leq n)$;

2 x y: Swap column x and column y $(1 \leq x,y \leq m)$;

3 x y: Add y to all elements in row x $(1 \leq x \leq n,1 \leq y \leq 10,000)$;

4 x y: Add y to all elements in column x $(1 \leq x \leq m,1 \leq y \leq 10,000)$;
 

Input
There are multiple test cases. The first line of input contains an integer $T (1\leq T\leq 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 \leq M_{i,j} \leq 10,000)$ for all $(1 \leq i \leq n,1 \leq j \leq m)$.
The following $q$ lines contains three integers $a(1 \leq a \leq 4)$, $x$ and $y$.
 

Output
For each test case, output 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
12 13 14 15 1 2 3 4 3 4 5 6 1 10 10 1
 

Hint
Recommand to use scanf and printf
 

Source
 

Statistic | Submit | Discuss | Note
Hangzhou Dianzi University Online Judge 3.0
Copyright © 2005-2024 HDU ACM Team. All Rights Reserved.
Designer & Developer : Wang Rongtao LinLe GaoJie GanLu
Total 0.000000(s) query 1, Server time : 2024-04-19 12:17:41, Gzip enabled