6920.Eulerian Subgraphs

Time Limit: 1s Memory Limit: 512MB

You are given an undirected graph that has $n$ nodes and $m$ edges.

We consider subgraphs that have all nodes of the original graph and some of its edges. A subgraph is called Eulerian if each node has even degree.

Your task is to count the number of Eulerian subgraphs modulo $10^9+7$ .

Input Format(From the terminal/stdin)

The first input line has two integers $n$ and $m$ : the number of nodes and edges. The nodes are numbered $1,2,\dots,n$ .

After this, there are $m$ lines that describe the edges. Each line has two integers $a$ and $b$ : there is an edge between nodes $a$ and $b$ . There is at most one edge between two nodes, and each edge connects two distinct nodes.

  • $1 \le n \le 10^5$
  • $0 \le m \le 2 \cdot 10^5$
  • $1 \le a,b \le n$

Output Format(To the terminal/stdout)

Print the number of Eulerian subgraphs modulo $10^9+7$ .

Sample Input

Copy
4 3
1 2
1 3
2 3
 · \n
 · \n
 · \n
 · \n

Sample Output

Copy
2
 \n

You can either keep or remove all edges, so there are two possible Eulerian subgraphs.

Source: CSES, Advanced Techniques, 2078

Submit

请先 登录

© 2025 FAQs