atcoder#ARC105F. [ARC105F] Lights Out on Connected Graph
[ARC105F] Lights Out on Connected Graph
Score : points
Problem Statement
Given is an undirected graph consisting of vertices numbered through and edges numbered through . It is guaranteed that is connected and contains no self-loops and no multi-edges. Edge connects Vertex and Vertex bidirectionally. Each edge can be painted red or blue. Initially, every edge is painted red.
Consider making a new graph by removing zero or more edges from . There are graphs that can be. Among them, find the number of good graphs defined below, modulo .
is said to be a good graph when both of the following conditions are satisfied:
- is connected.
- It is possible to make all edges blue by doing the following operation zero or more times.- Choose one vertex and change the color of every edge incident to that vertex, that is, red to blue and vice versa.
- Choose one vertex and change the color of every edge incident to that vertex, that is, red to blue and vice versa.
Constraints
- All values in input are integers.
- is connected and has no self-loops and no multi-edges.
Input
Input is given from Standard Input in the following format:
Output
Print the number of good graphs among the ones that can be, modulo .
3 2
1 2
2 3
1
- The conditions are satisfied only if neither Edge nor Edge is removed.- In this case, we can make all edges blue by, for example, doing the operation for Vertex .
- In this case, we can make all edges blue by, for example, doing the operation for Vertex .
- Otherwise, the graph gets disconnected and thus does not satisfy the condition.
4 6
1 2
1 3
1 4
2 3
2 4
3 4
19
17 50
16 17
10 9
16 10
5 17
6 15
5 9
15 11
16 1
8 13
6 17
15 3
16 15
11 3
7 6
1 4
11 13
10 6
10 12
3 16
7 3
16 5
13 3
12 13
7 11
3 12
13 10
1 12
9 15
11 14
4 6
13 2
6 1
15 2
1 14
15 17
2 11
14 13
16 9
16 8
8 17
17 12
1 11
6 12
17 2
8 1
14 6
9 7
11 10
5 14
17 7
90625632
- Be sure to find the count modulo .