303656: CF706E. Working routine
Memory Limit:256 MB
Time Limit:2 S
Judge Style:Text Compare
Creator:
Submit:0
Solved:0
Description
Working routine
题意翻译
工作使艾奇快乐。 勤奋的工作为国家直接贡献了GDP,艾奇认为只要对国家有利,即使牺牲自己生命也心甘情愿,绝不会因为自己可能受到祸害而躲开。 当艾奇无聊的时候,她就会去工作,然而并不是每次工作都是轻松而愉悦的。 当天艾奇又一次来到了学校,等待着她的是一个有n 行m 列的巨大的矩阵和q个任务。对于每个任务,艾奇被要求交换这个矩阵中的两个子矩阵。 每个任务,艾奇会获得六个正整数x1,y1,x2,y2,h,w。x1,y1 代表了第一个矩阵 左上角的行列位置(即在第x1 行第y1 列);x2,y2 代表了第二个矩阵左上角的行列位置,h,w 代表了这两个矩阵的高和宽(即行数和列数)。 数据保证每两个需要交换的矩阵互不相交或相邻。也就是说,没有任何一个元素同时属于这两个矩阵,也不存在某两个元素分别属于两个矩阵且相邻(共边)。 输入第一行三个整数n,m,q,表示矩阵的行数,列数,交换次数 接下来n行,每行m个数,表示原始矩阵 接下来q行,每行6个正整数x1,y1,x2,y2,h,w,表示要交换的两个矩阵的左上角坐标及所求矩阵的行数和列数。 输出n行m个数,表示完成q次交换后的矩阵题目描述
Vasiliy finally got to work, where there is a huge amount of tasks waiting for him. Vasiliy is given a matrix consisting of $ n $ rows and $ m $ columns and $ q $ tasks. Each task is to swap two submatrices of the given matrix. For each task Vasiliy knows six integers $ a_{i} $ , $ b_{i} $ , $ c_{i} $ , $ d_{i} $ , $ h_{i} $ , $ w_{i} $ , where $ a_{i} $ is the index of the row where the top-left corner of the first rectangle is located, $ b_{i} $ is the index of its column, $ c_{i} $ is the index of the row of the top-left corner of the second rectangle, $ d_{i} $ is the index of its column, $ h_{i} $ is the height of the rectangle and $ w_{i} $ is its width. It's guaranteed that two rectangles in one query do not overlap and do not touch, that is, no cell belongs to both rectangles, and no two cells belonging to different rectangles share a side. However, rectangles are allowed to share an angle. Vasiliy wants to know how the matrix will look like after all tasks are performed.输入输出格式
输入格式
The first line of the input contains three integers $ n $ , $ m $ and $ q $ ( $ 2<=n,m<=1000 $ , $ 1<=q<=10000 $ ) — the number of rows and columns in matrix, and the number of tasks Vasiliy has to perform. Then follow $ n $ lines containing $ m $ integers $ v_{i,j} $ ( $ 1<=v_{i,j}<=10^{9} $ ) each — initial values of the cells of the matrix. Each of the following $ q $ lines contains six integers $ a_{i} $ , $ b_{i} $ , $ c_{i} $ , $ d_{i} $ , $ h_{i} $ , $ w_{i} $ ( $ 1<=a_{i},c_{i},h_{i}<=n $ , $ 1<=b_{i},d_{i},w_{i}<=m $ ).
输出格式
Print $ n $ lines containing $ m $ integers each — the resulting matrix.
输入输出样例
输入样例 #1
4 4 2
1 1 2 2
1 1 2 2
3 3 4 4
3 3 4 4
1 1 3 3 2 2
3 1 1 3 2 2
输出样例 #1
4 4 3 3
4 4 3 3
2 2 1 1
2 2 1 1
输入样例 #2
4 2 1
1 1
1 1
2 2
2 2
1 1 4 1 1 2
输出样例 #2
2 2
1 1
2 2
1 1