| 시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
|---|---|---|---|---|---|
| 1 초 | 64 MB | 28 | 18 | 15 | 75.000% |
We shall name a square matrix as spiral123 if it has the following properties:
For example a 5x5 spiral123 matrix is the following:
For a given natural number n, you should generate a n x n spiral123 matrix.
The input contains only one natural number n on the first line.
If there is solution, output must contain n lines, each with n numbers separated with one space, representing the required matrix. If there is no solution, on the single line of the output file, the -1 value will be written.
5
0 1 0 2 3 0 2 3 0 1 1 3 0 0 2 3 0 2 1 0 2 0 1 3 0
Another correct solution would be:
0 1 2 3 0 2 3 0 0 1 0 0 3 1 2 1 0 0 2 3 3 2 1 0 0