| 시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
|---|---|---|---|---|---|
| 12 초 | 512 MB | 44 | 15 | 14 | 42.424% |
Bobo gets a bipartite graph with $n$ vertices (that is, a graph without odd cycles).
He colors each vertex into black or white, and then calculates the product of each edge's value. The value of an edge is determined by the colors of its two end points. Thus, there can be 2ドル \times 2 = 4$ different values associated to a given edge.
Now bobo would like to know the sum of products of all 2ドル^n$ possible coloring, modulo $(10^9+7)$.
The first line contains 2ドル$ integers $n, m$ which denotes the number of vertices and edges (2ドル \leq n \leq 40,ドル 1ドル \leq m \leq 100$).
Vertices are numbered by 1,ドル 2, \dots, n$ for convenience.
Each of the following $m$ lines contains 6ドル$ integers $a_i, b_i, v_{i, 00}, v_{i, 01}, v_{i, 10}, v_{i, 11},ドル which denotes an edge between vertices $a_i$ and $b_i$ (1ドル \leq a_i, b_i \leq n, 0 \leq v_{i, 00}, v_{i, 01}, v_{i, 10}, v_{i, 11} \leq 10^9$).
A single integer denotes the sum.
2 1 1 2 1 2 3 4
10
3 2 1 2 1 0 0 1 2 3 1 0 0 1
2