시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
---|---|---|---|---|---|
2 초 | 256 MB | 8 | 3 | 2 | 50.000% |
You are given a complete undirected graph with $7n$ vertices (here $n$ is a positive integer). Your task is to paint its edges in $n$ colors in such a way that for each pair of vertices and each color there is a path of at most two edges of this color connecting this pair of vertices. More formally, for each pair of vertices $u, v$ and each color $c$ at least one of the two options should hold:
The only line of input contains a positive integer $n$ ($7\leqslant 7n\leqslant 1000$).
Let us number the colors from $1$ to $n$. Let $c_{i, j}$ be $0$ if $i = j$, and the color of the edge $(i, j)$ in your coloring otherwise (in particular, in this case $c_{i, j} = c_{j, i}$). Print $c_{i, j}$ in $7n$ lines containing $7n$ numbers each.
It is guaranteed that a solution exists.
1
0 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 0
2
0 1 2 2 1 1 1 1 1 1 1 1 1 1 1 0 1 2 2 2 2 2 2 2 2 2 2 2 2 1 0 1 2 2 2 2 2 2 2 2 2 2 2 2 1 0 1 1 1 1 1 1 1 1 1 1 1 2 2 1 0 2 2 2 2 2 2 2 2 2 1 2 2 1 2 0 1 1 1 1 1 1 1 1 1 2 2 1 2 1 0 1 1 1 1 1 1 1 1 2 2 1 2 1 1 0 1 1 1 1 1 1 1 2 2 1 2 1 1 1 0 1 1 1 1 1 1 2 2 1 2 1 1 1 1 0 1 1 1 1 1 2 2 1 2 1 1 1 1 1 0 1 1 1 1 2 2 1 2 1 1 1 1 1 1 0 1 1 1 2 2 1 2 1 1 1 1 1 1 1 0 1 1 2 2 1 2 1 1 1 1 1 1 1 1 0
The second sample test corresponds to the following coloring:
Here are two separate subgraphs for both colors: