Convex Sets on Graph
Time limit2sMemory limit512 MB
Count the vertex subsets S of a connected graph where every simple path between two vertices of S lies entirely inside S, modulo 998244353.
- Level
Hard9 of 10
- Topics
- Graph, Dynamic programming, Tree
- Solved
- No attempts yet
Problem
A set of vertices of an undirected graph is convex if, for any two distinct vertices from the set, any simple path between them lies entirely within that set. Count the convex subsets of vertices of a given graph.
Input
The first line contains two integers and (; ), the number of vertices and the number of edges. Each of the next lines contains two space-separated integers and , the endpoints of an edge (; ). The graph is connected and has no multiple edges.
Output
Print the number of convex subsets modulo the prime .