No.3155 Same Birthday
Problem Statement
There are $N$ people.
For $i=1,2,\dots,N$, the birth month of the $i$-th person is $A_i$ and their birth day is $B_i$.
If there exists a pair of people whose birth months and birth days both match, print Yes;
otherwise, print No.
Here, "there exists a pair of people whose birth months and birth days both match" means that there exist $i,j \ (1 \le i \lt j \le N)$ satisfying $A_i=A_j$ and $B_i=B_j$.
Constraints
- All input values are integers.
- $2 \le N \le 2\times 10^5$
- $1 \le A_i, B_i \le 10^3 \ (1 \le i \le N)$
Input
$N$ $A_1\ B_1$ $A_2\ B_2$ $\vdots$ $A_N\ B_N$
Output
If there exists a pair of people satisfying the condition, print Yes;
otherwise, print No.
Sample
Sample 1
Input
5 4 8 9 6 2 20 1 13 2 20
Output
Yes
The $3$-rd person and the $5$-th person share the same birthday, month $2$, day $20$, so print Yes.
Sample 2
Input
8 5 23 8 23 6 28 1 5 12 27 3 27 9 22 9 13
Output
No
There exist pairs of people whose birth months only or birth days only match, but there is no pair of people whose birth months and birth days both match.
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。
jastaway
butsurizuki