Home > other >  Blue cup back to the form in python implementation,
Blue cup back to the form in python implementation,

Time:10-03

Back to form number is along the edge of the matrix to take, if the current direction of countless desirable or have been taken, then turn left 90 degrees, is located in the left upper corner of the matrix at the beginning, direction, down
Input format the first line is two positive integers less than 200 m, n, said the row and column of the matrix, the next m lines per n integers, said this matrix,
Output format output only a line, a total number of mn for input matrix to form several results, several are separated with a space, do not have extra Spaces at the end of the line,
The sample input
3 3
1 2 3
4 5 6
7 8 9
Sample output
1 4 7 8 9 6 3 2 5
The sample input
3 2
1
23, 4,
5 6
Sample output
1 3 4 5 6 2