Problem of the day
'N' = 2, 'A' = { {0, 1}, {0, 0} }.
After twisting, the grid looks like :
'A' = { {1, 0}, {0, 0} }.
After changing the colours, the grid looks like :
'A' = { {0, 1}, {1, 1} }.
The first line contains an integer 'T', which denotes the number of test cases to be run. Then the test cases follow.
The first line of each test case contains an integer 'N' denoting the dimension of the grid.
The next 'N' lines contain 'N' space-separated integers denoting the colour of a cell.
For each test case, print 'N' lines containing 'N' space-separated integers denoting the colour of each cell of the final grid.
Print the output of each test case in a new line.
You don’t need to print anything. It has already been taken care of. Just implement the given function.
1 <= T <= 10
1 <= N <= 100.
Sum of 'N' ^ 2 over all the test cases is <= 10 ^ 4.
Time Limit: 1 sec
2
3
1 1 0
0 1 1
1 0 0
1
0
1 0 0
0 0 1
1 1 0
1
For test 1:
After twisting the grid looks like : { {0, 1, 1}, {1, 1, 0}, {0, 0, 1} }.
After changing the colour of cells the grid looks like : { {1, 0, 0}, {0, 0, 1}, {1, 1, 0} }.
For test 2:
After twisting the grid looks like : { {0} }.
After changing the colour of cells the grid looks like : { {1} }.
2
3
1 1 1
1 1 1
1 1 1
4
1 1 1 1
0 0 0 0
1 1 1 1
0 0 0 0
0 0 0
0 0 0
0 0 0
0 0 0 0
1 1 1 1
0 0 0 0
1 1 1 1