Advertisement
Aikiro42

dwadeugfsi

Jan 26th, 2020
317
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.38 KB | None | 0 0
  1. T = int(input())
  2.  
  3. solved_grids = []
  4.  
  5. i = 0
  6. while i < T:
  7.     r, c, M, N = map(int, input().split())
  8.     G = [input().split(" ") for _ in range(r)]
  9.     for x in range(len(G)):
  10.         G[x] = G[x][-(M % c):] + G[x][:-(M % c)]
  11.     G = G[(N % r):] + G[:(N % r)]
  12.     solved_grids.append(G)
  13.     i += 1
  14.  
  15. for grid in solved_grids:
  16.     for row in grid:
  17.         print(' '.join(row))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement