CF1093D Beautiful Graph
Description
You are given an undirected unweighted graph consisting of $ n $ vertices and $ m $ edges.
You have to write a number on each vertex of the graph. Each number should be $ 1 $ , $ 2 $ or $ 3 $ . The graph becomes beautiful if for each edge the sum of numbers on vertices connected by this edge is odd.
Calculate the number of possible ways to write numbers $ 1 $ , $ 2 $ and $ 3 $ on vertices so the graph becomes beautiful. Since this number may be large, print it modulo $ 998244353 $ .
Note that you have to write exactly one number on each vertex.
The graph does not have any self-loops or multiple edges.
Input Format
N/A
Output Format
N/A
Explanation/Hint
Possible ways to distribute numbers in the first test:
1. the vertex $ 1 $ should contain $ 1 $ , and $ 2 $ should contain $ 2 $ ;
2. the vertex $ 1 $ should contain $ 3 $ , and $ 2 $ should contain $ 2 $ ;
3. the vertex $ 1 $ should contain $ 2 $ , and $ 2 $ should contain $ 1 $ ;
4. the vertex $ 1 $ should contain $ 2 $ , and $ 2 $ should contain $ 3 $ .
In the second test there is no way to distribute numbers.