Unlocker | CodeVita Solutions | Codewindow.in
Problem Description
Constraints
1 < M, N <= 300
0 <= Numbers in matrix < 100
1 <= Number of rotations <= 10^9
M%2=0 && N%2=0
Input
First line contains two space separated integer M and N which denotes the number of rows and number of columns, respectively
Next M lines contain N space separated integers depicting the locked matrix
Last line contains L space separated integers, where L is the number of layers. Each number on this line denotes the number of rotations for every layer from 1 to L
Output
Print unlocked matrix
Time Limit
2
Examples
Example 1
Input
2 2
1 2
3 4
2
Output
4 3
2 1
Explanation:
There is only one layer. So, we have to rotate it in anti-clockwise direction with 2 rotations.
Example 2
Input
4 4
1 2 3 4
2 3 4 5
2 4 5 6
2 3 4 5
2 2
Output
3 4 5 6
2 5 4 5
1 4 3 4
2 2 2 3
Explanation:
Here we have to rotate layer1 in anti-clockwise direction with 2 rotations, and layer2 clockwise with 2 rotations.
coming soon..