Codeforces Round 1082 (Div. 1)
G
Codeforces Heuristic Contest 1001
Codeforces
3500
原题
← F2→
翻译中…

There is a graph of $n^2$ vertices, where vertices are labeled by integer pairs $(r,c)$ such that $1 \le r,c \le n$. Vertices $(r_1,c_1)$ and $(r_2,c_2)$ are directly connected if and only if $(r_1-r_2)^2+(c_1-c_2)^2=\color{red}{13}$. This graph is called the Zebra Graph of dimensions $n \times n$.

翻译中…

Please find a subset of vertices $S$ in the Zebra Graph of dimensions $n \times n$, which satisfies the following condition.

翻译中…
  • The graph induced$^{\text{∗}}$ by the subset $S$ is isomorphic to a cycle graph of at least $\left\lfloor{\frac{n^2}{e}}\right\rfloor$ vertices$^{\text{†}}$.
翻译中…

It can be shown that such a subset of vertices exists under the constraints of this problem.

翻译中…

$^{\text{∗}}$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$.$^{\text{†}}$Here, $e$ is the mathematical constant equal to the limit $\lim \limits_{n \to \infty} \left ({1 + \frac{1}{n}} \right )^n \approx 2.71828182$. Note that the value of $\frac{1}{e}$ is approximately $0.36787944$.

翻译中…

Input

翻译中…

The first and only line of input contains a single integer $n$ ($n\in \{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.

翻译中…

Output

翻译中…

Output $n$ lines, each containing a string $s_i$ 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 $s_r$ should be '1'. Otherwise, the $c$-th letter of $s_r$ should be '0'.

翻译中…

If there are multiple solutions, print any of them.

翻译中…

Note

翻译中…

For the example output, the induced graph corresponding to the subset $S$ is shown below.

翻译中…

image

翻译中…

This graph is isomorphic to the cycle graph $C_{16}$ consisting of $16$ vertices. As $16 \ge \left\lfloor{\frac{n^2}{e}}\right\rfloor = 9$, the output satisfies the problem's condition.

翻译中…

样例

Input #1
5
Output #1
01110
11011
10001
11011
01110
InputCopy OutputCopy
题目信息
题号
2201G
时间限制
9 s
内存限制
1001 MB
标签
构造

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。