시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
---|---|---|---|---|---|
1 초 | 512 MB | 14 | 11 | 11 | 78.571% |
You are given an undirected graph without loops and multiple edges.
Find the number of ways to write integers [0; 4] on edges such that for each vertex, the sum of weights of edges incident to it will be equal to zero modulo five (i.e. is equal to 5k for some integer k).
As the answer may be very large, you only need to find it modulo 998 244 353.
The first line of input contains one integer t (1 ≤ t ≤ 500 000): the number of testcases.
The next lines contain t descriptions of test cases.
The first line of each test case contains two integers n, m (1 ≤ n ≤ 200 000, 0 ≤ m ≤ 300 000): the number of vertices.
The next m lines contain descriptions of edges, where the i-th of them contains two integers ai, bi (1 ≤ ai, bi ≤ n, ai ≠ bi), denoting an edge connecting vertices ai and bi in the graph.
It is guaranteed that there are no multiple edges.
It is also guaranteed that the total sum of n + m in all test cases is at most 500 000.
For each test case, print one integer: the number of ways to write integers [0; 4] on edges such that for each vertex, the sum of weights of edges incident to it will be equal to zero modulo five (i.e. is equal to 5k for some integer k), modulo 998 244 353.
3 1 0 3 3 1 2 2 3 3 1 4 4 1 2 2 3 3 4 4 1
1 1 5
Camp > Petrozavodsk Programming Camp > Winter 2020 > Day 3: 300iq Petrozavodsk Contest III J번