#P10591. BZOJ4671 异或图

BZOJ4671 异或图

Background

This problem comes from the original BZOJ. We acknowledge that the copyright of the statement and the original testdata belongs to the original BZOJ or the problem setter(s) who authorized BZOJ to use the problem. If you are the copyright owner and believe that we have infringed your rights, please contact us.

Problem Description

Define the XOR of two graphs G1G_1 and G2G_2 with the same number of vertices as a new graph GG. If the total number of occurrences of (u,v)(u, v) in G1G_1 and G2G_2 is 11, then the edge (u,v)(u, v) is in GG; otherwise, this edge is not in GG.

Now you are given ss graphs G1sG_{1\sim s} with the same number of vertices, S={G1,G2,,Gs}S=\{G_1,G_2,\dots,G_s\}. How many subsets of SS have an XOR that is a connected graph?

Input Format

The first line contains an integer ss, representing the number of graphs.

Each of the following lines contains a binary string. The binary string on line ii is gig_i, where gig_i is obtained from the original graph by the following pseudocode. The vertices are numbered starting from 11, and let the number of vertices be nn.

Algorithm 1 Print a graph G = (V, E)

for i = 1 to n do
    for j = i + 1 to n do
        if G contains edge (i, j) then
            print 1
        else
            print 0
        end if
    end for
end for

Output Format

Output one line containing an integer, representing the number of valid ways.

3 
1 
1 
0
4

Hint

For 100%100\% of the data, 2n102\leq n\leq 10 and 1s601\leq s\leq 60.

Translated by ChatGPT 5