#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 and with the same number of vertices as a new graph . If the total number of occurrences of in and is , then the edge is in ; otherwise, this edge is not in .
Now you are given graphs with the same number of vertices, . How many subsets of have an XOR that is a connected graph?
Input Format
The first line contains an integer , representing the number of graphs.
Each of the following lines contains a binary string. The binary string on line is , where is obtained from the original graph by the following pseudocode. The vertices are numbered starting from , and let the number of vertices be .
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 of the data, and .
Translated by ChatGPT 5