Androgynos
题号:NC52022
时间限制:C/C++/Rust/Pascal 1秒,其他语言2秒
空间限制:C/C++/Rust/Pascal 256 M,其他语言512 M
Special Judge, 64bit IO Format: %lld

题目描述

In graph theory, an isomorphism of graphs G and H is a bijection between the vertex sets of G and H. The complement of a graph G is a graph H on the same vertices such that two distinct vertices of H are adjacent if and only if they are not adjacent in G.

Give a positive integer n, check whether there exists a simple undirected graph G having n vertices, which is isomorphic to its complement graph H. If the graphs G and H exist, report them with any possible isomorphism.

输入描述:

There are multiple test cases. The first line contains an integer T (), indicating the number of test cases. Test cases are given in the following.

Each test case consists of only one line, containing an integer n ().

输出描述:

For each test case, output "Case #x: y" in one line (without quotes), where x indicates the case number starting from 1, and y () denotes whether or not the graphs exist in this test case.

If the graphs exist, then output (n + 1) extra lines.

The first n lines represent the graph G, where each line contains a binary string of length n. In the i-th line, the j-th character is '1' when the i-th vertex and the j-th one are adjacent, or otherwise, in case they are not adjacent, is '0'. Note that must be '0' and must be the same as .

The last line contains n space-separated integers f_1, f_2, , f_n, representing an isomorphism of graphs G and H in which the i-th vertex in the graph G is mapped to the f_i-th vertex in the complement graph H. Note that every two consecutive integers in one line should be separated by a single space,
示例1

输入

复制
4
1
2
3
4

输出

复制
Case #1: Yes
0
1
Case #2: No
Case #3: No
Case #4: Yes
0100
1010
0101
0010
2 4 1 3