atcoder#ABC187F. [ABC187F] Close Group
[ABC187F] Close Group
Score : points
Problem Statement
Given is a simple undirected graph with vertices and edges. The vertices are numbered , and the -th edge connects Vertices and .
Find the minimum possible number of connected components in the graph after removing zero or more edges so that the following condition will be satisfied:
Condition: For every pair of vertices such that , if Vertices and belong to the same connected component, there is an edge that directly connects Vertices and .
Constraints
- All values in input are integers.
- for .
Input
Input is given from Standard Input in the following format:
Output
Print the answer.
3 2
1 2
1 3
2
Without removing edges, the pair violates the condition. Removing one of the edges disconnects Vertices and , satisfying the condition.
4 6
1 2
1 3
1 4
2 3
2 4
3 4
1
10 11
9 10
2 10
8 9
3 4
5 8
1 8
5 6
2 5
3 6
6 9
1 9
5
18 0
18