UVa 10608

From Algorithmist
Jump to navigation Jump to search

10608 - Friends[edit]

Summary[edit]

Find the biggest group of friends in a town.

Explanation[edit]

In this problem, we're trying to find the number of distinct sets, and can be solved by the Union Find algorithm.

Gotcha's[edit]

Don't read any more cases than are listed in the beginning of the input!

Implementations[edit]

Input[edit]

2
3 2
1 2
2 3
10 12
1 2
3 1
3 4
5 4
3 5
4 6
5 2
2 1
7 10
1 2
9 10
8 9

Output[edit]

3
6