当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。
| |||||||||||||||||||||||||
Figure (a) | |||||||||||||||||||||||||
| |||||||||||||||||||||||||
Figure (b) | |||||||||||||||||||||||||
| |||||||||||||||||||||||||
Figure (c) |
Your program will be tested on one or more test cases. The first input line of a test case is an integer N which is the size of the grid. N input lines will follow, each line made of N integer values specifying the values in the grid in a row-major order. Note than 0 < N ≤ 1,000 and grid values are natural numbers less than or equal to 1,000,000.
The end of the test cases is identified with a dummy test case with N = 0.
For each test case, output the result on a single line using the following format:
k. result
Where k is the test case number (starting at 1), and result is "YES" or "NO" (without the double quotes.)
4 9 5 1 2 13 7 11 3 14 6 10 4 15 16 12 8 3 1 2 3 5 6 7 8 9 4 0
1. YES 2. NO
时间上限 | 内存上限 |
1000 | 65536 |