atcoder#ARC111B. [ARC111B] Reversible Cards
[ARC111B] Reversible Cards
Score : points
Problem Statement
We have cards numbered to . Each side of each card has a color represented by a positive integer.
One side of Card has a color , and the other side has a color .
For each card, you can choose which side shows up. Find the maximum possible number of different colors showing up.
Constraints
- All numbers in input are integers.
Input
Input is given from Standard Input in the following format:
Output
Print the answer.
4
1 2
1 3
4 2
2 3
4
We can choose the sides with , , , to have four colors.
2
111 111
111 111
1
They are painted with just one color.
12
5 2
5 6
1 2
9 7
2 7
5 5
4 2
6 7
2 2
7 8
9 7
1 8
8