Bae Chanwoo likes arrays
Time limit3sMemory limit512 MB
Given an N by M array, apply q queries that either set one cell or swap two rows, then print the final array.
- Level
Easy3 of 10
- Topics
- Array, Implementation
- Solved
- No attempts yet
Problem
Chanwoo learned about two-dimensional arrays in an introductory programming class today. He found it so interesting that he decided to apply operations to the two-dimensional array.
Two kinds of operations are given as queries.
0 i j k: Change the value in column of row to .1 i j: Swap row and row .
A swap exchanges every element of row with the corresponding element of row .
After performing all queries, print the final array.
Input
The first line contains the number of rows , the number of columns , and the number of queries .
From the second line onward, lines give the two-dimensional array with rows and columns. Each element of the array is an integer from 1 to .
The next lines contain the queries. A query has the form 0 i j k or 1 i j. If the first value is 0, perform the first operation. If it is 1, perform the second operation.
For the first operation, , , and satisfy , , and , where is an integer.
For the second operation, and satisfy .
Output
Print the two-dimensional array after performing all queries.