atcoder#ABC262E. [ABC262E] Red and Blue Graph
[ABC262E] Red and Blue Graph
Score : points
Problem Statement
You are given a simple undirected graph with vertices and edges. The vertices are numbered , and the -th edge connects Vertices and .
There are ways to paint each vertex red or blue. Find the number, modulo , of such ways that satisfy all of the following conditions:
- There are exactly vertices painted red.
- There is an even number of edges connecting vertices painted in different colors.
Constraints
- All values in input are integers.
Input
Input is given from Standard Input in the following format:
Output
Print the answer.
4 4 2
1 2
1 3
2 3
3 4
2
The following two ways satisfy the conditions.
- Paint Vertices and red and Vertices and blue.
- Paint Vertices and red and Vertices and blue.
In either of the ways above, the -nd and -rd edges connect vertices painted in different colors.
10 10 3
1 2
2 4
1 5
3 6
3 9
4 10
7 8
9 10
5 9
3 4
64