Koosaga's problem
Time limit2sMemory limit1024 MB
Count the edge subsets of size at most two that make the connected graph bipartite, where no smaller removal set also works.
- Level
Hard8 of 10
- Topics
- Graph, BFS, Combinatorics
- Solved
- No attempts yet
Problem
Jaehyun solved a problem about the maximum cut of a graph at the Petrozavodsk Winter 2019 camp, so he decided to give you another problem of the same nature.
You are given a simple connected graph with vertices and edges. Find the number of edge subsets that satisfy the following:
- Removing the edges in makes the graph bipartite.
- .
- No other subset with satisfies the first two conditions.
Note that can be empty.
Input
The first line contains two integers and (, ).
Each of the next lines contains two space-separated integers and (), describing an edge between vertex and vertex .
The graph has no loops or multiple edges, and it is connected.
Output
Print the number of edge subsets that satisfy the conditions above.