Königsberg Bridges
Time limit3sMemory limit512 MB
Given a graph, add edges so that a simple path passes through every bridge, and find the maximum number of bridges possible.
Problem
Given a graph, we say it is Königsbergsy if there is a simple path that goes through all of its bridges. Here, a bridge is an edge that disconnects the graph when removed. A simple path is a path that visits each vertex at most once.
Given a graph , add some edges to it to make it Königsbergsy. You may add more than one edge between the same pair of vertices. Determine the maximum number of bridges that the resulting graph can have.
Input
The first line contains two integers and (; ), the number of vertices and the number of edges of .
Each of the next lines contains two integers , (), describing an edge between vertices and .
Output
Output one integer, the maximum number of bridges the resulting graph can have.