AtCoder Regular Contest 111
翻译中…
Problem Statement
翻译中…
We have $N$ cards numbered $1$ to $N$. Each side of each card has a color represented by a positive integer.
翻译中…
One side of Card $i$ has a color $a_i$, and the other side has a color $b_i$.
翻译中…
For each card, you can choose which side shows up. Find the maximum possible number of different colors showing up.
翻译中…
Constraints
翻译中…
$1 \leq N \leq 200000$$1 \leq a_i,b_i \leq 400000$- All numbers in input are integers.
翻译中…
Input
翻译中…
Input is given from Standard Input in the following format:
翻译中…
N
a_1 b_1
a_2 b_2
:
a_N b_N
翻译中…
Output
翻译中…
Print the answer.
翻译中…
样例
Input #1
4
1 2
1 3
4 2
2 3
Output #1
4
We can choose the sides with $1$, $3$, $4$, $2$ to have four colors.
Input #2
2
111 111
111 111
Output #2
1
They are painted with just one color.
Input #3
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
Output #3
8
题目信息
题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。