1234 : 贵校是构造王国吗 II
- 时间限制Time Limit
- 2 秒Sec
- 内存限制Memory Limit
- 256 兆MB
- 提交次数Submitted
- 1 次Times
- 通过次数Solved
- 1 次Times
特判评测 Special
读写方式与标准评测相同。答案可能不唯一,是否正确由本题的特判程序判定,输出格式以题面为准。
I/O is the same as standard judge. Several outputs may be valid; this problem’s special judge decides correctness. Follow the output format in the statement.
| 输入Input | 标准输入。Standard input. |
|---|---|
| 输出Output | 标准输出,格式以题面为准。Standard output; format as specified in the statement. |
| 时间与内存Time and memory | 记选手程序的 CPU 时间和内存峰值。判定程序不计入。题目上的限制只约束选手程序。The record is the solution’s CPU time and peak memory. The checker is not included. The limits apply only to the solution. |
题目描述Description
众所周知,你们正在参加中国构造题竞赛(Chinese Constructive Problem Contest, CCPC),毫无疑问,命题学校中山大学身为构造王国非常希望你们去挑战一些相关的问题。
给定一个 \(n \times n\) 的网格,你需要使用 \([0,4n^2-1]\) 范围内的数字填充,并且满足以下要求。
每个数字最多出现 \(5\) 次。
每个单元格应填充恰好一个数字。
对于任意两个有共同边的相邻单元格,它们按位与的结果应该恰好等于 \(0\)。
构造一个合法的解决方案,或者判断这是不可能的。
输入格式Input
输入一个数字 \(n\ (1\le n\le 2000)\),表示网格的大小。
输出格式Output
如果存在合法的解决方案,首先在第一行输出 。然后,输出一个 \(n\times n\) 的整数矩阵,其中每个数字在范围 \([0, 4n^2-1]\) 内,表示你所构造的矩阵。
如果存在多个合法的解决方案,输出其中任意一个即可。
如果不存在合法的解决方案,输出一行 即可。
样例Sample
出题Author
SYSU
题目到此结束End of problem