CF2201G.Codeforces Heuristic Contest 1001
NOI/NOI+/CTSC
通过率:0%
时间限制:9.00s
内存限制:1001MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
There is a graph of n2 vertices, where vertices are labeled by integer pairs (r,c) such that 1≤r,c≤n. Vertices (r1,c1) and (r2,c2) are directly connected if and only if (r1−r2)2+(c1−c2)2=13. This graph is called the Zebra Graph of dimensions n×n.
Please find a subset of vertices S in the Zebra Graph of dimensions n×n, which satisfies the following condition.
- The graph induced∗ by the subset S is isomorphic to a cycle graph of at least ⌊en2⌋ vertices†.
It can be shown that such a subset of vertices exists under the constraints of this problem.
∗The induced graph of a subset of vertices X is a graph that contains all vertices in X and all edges whose both endpoints are in X.
†Here, e is the mathematical constant equal to the limit n→∞lim(1+n1)n≈2.71828182. Note that the value of e1 is approximately 0.36787944.
存在一个包含 n2 个顶点的图,其顶点用整数对 (r,c) 标记,其中 1≤r,c≤n。当且仅当 (r1−r2)2+(c1−c2)2=13 时,顶点 (r1,c1) 与 (r2,c2) 直接相连。该图称为 n×n 维的“斑马图”(Zebra Graph)。
请在 n×n 维斑马图中找出一个顶点子集 S,使其满足如下条件:
- 由子集 S 所导出的子图∗ 同构于一个至少包含 ⌊en2⌋ 个顶点的环图(cycle graph)†。
可以证明,在本题的约束条件下,这样的顶点子集 S 必然存在。
∗ 顶点子集 X 的导出子图是指:包含 X 中所有顶点,并且包含所有两个端点均属于 X 的边所构成的图。
† 此处 e 是数学常数,定义为极限 n→∞lim(1+n1)n≈2.71828182。注意,e1 的值约为 0.36787944。
输入格式
The first and only line of input contains a single integer n (n∈5,1001).
There are only two input files for this problem:
- The first input file (the example input) has n=5;
- The second input file has n=1001.
Hacks are disabled for this problem.
输入仅有一行,包含一个整数 n(n∈{5,1001})。
本题仅有两个输入文件:
- 第一个输入文件(样例输入)中 n=5;
- 第二个输入文件中 n=1001。
本题禁用 Hack 功能。
输出格式
Output n lines, each containing a string si of length n denoting the i-th row of the graph. If the vertex (r,c) is an element of S, then the c-th letter of sr should be '1'. Otherwise, the c-th letter of sr should be '0'.
If there are multiple solutions, print any of them.
输出 n 行,每行包含一个长度为 n 的字符串 si,表示图的第 i 行。若顶点 (r,c) 属于集合 S,则 sr 的第 c 个字符应为 '1';否则,sr 的第 c 个字符应为 '0'。
若存在多个解,输出任意一个即可。
输入输出样例
输入#1
5
输出#1
01110 11011 10001 11011 01110
说明/提示
For the example output, the induced graph corresponding to the subset S is shown below.

This graph is isomorphic to the cycle graph C16 consisting of 16 vertices. As 16≥⌊en2⌋=9, the output satisfies the problem's condition.
对于示例输出,子集 S 对应的导出子图如下所示。

该图同构于由 16 个顶点构成的环图 C16。由于 16≥⌊en2⌋=9,因此该输出满足题目的条件。
输入解题思路,AI测评打分。不知道怎么写?