Score : 300 points
There are N cities numbered 1 through N, and M bidirectional roads numbered 1 through M. Road i connects City A_i and City B_i.
Snuke can perform the following operation zero or more times:
After he finishes the operations, it must be possible to travel from any city to any other cities by following roads (possibly multiple times).
What is the minimum number of roads he must build to achieve the goal?
Input is given from Standard Input in the following format:
N M A_1 B_1 : A_M B_M
Print the answer.
3 1 1 2
1
Initially, there are three cities, and there is a road between City 1 and City 2.
Snuke can achieve the goal by building one new road, for example, between City 1 and City 3. After that,