A town consists of N road intersections and E roads, with road i connecting towns Ai to Bi. It is guaranteed that no two roads connect the same two towns. At first, the entire town is connected, meaning it is possible to travel from any road intersection to any other through a series of roads. You are evil, and you want to bomb a particular road intersection, making it impassable. This will split the town up into several connected components, where it is only possible to travel between road intersections within each component. Given the map of the town, find out the maximum number of connected components you can split the town into.
The first line of input will contain two integers, N and E.
The next E lines of input will contain two integers each, Ai and Bi.
The output should contain one line with one integer, the maximum number of connected components that can be formed.
For all subtasks: 0 ≤ Ai, Bi < N.
Subtask 1 (21%): 2 ≤ N, E ≤ 1000.
Subtask 2 (15%): 2 ≤ N ≤ 200000, E = N - 1.
Subtask 3 (19%): 2 ≤ N ≤ 200000, E = N.
Subtask 4 (17%): 2 ≤ N, E ≤ 200000, you only have to determine if the maximum number is 1 or not 1. If the answer is not 1, any response from your program which is not 1 will be judged as correct.
Subtask 5 (28%): 2 ≤ N, E ≤ 200000.
Subtask 6 (0%): Sample Testcases.
9 9 0 1 1 2 1 3 2 4 3 4 4 5 4 6 6 7 6 8
3
5 4 0 1 0 2 0 3 0 4
4
4 6 0 1 0 2 0 3 1 2 1 3 2 3
1
Subtask | Score |
---|---|
1 | 21 |
2 | 15 |
3 | 19 |
4 | 17 |
5 | 28 |
6 | 0 |