問題一覧 > 通常問題

No.3155 Same Birthday

レベル : / AI推定難易度 : 118 / 実行時間制限 : 1ケース 2.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (解説公開後に AC するまで非表示) / 解いたユーザー数 148
作問者 : fluorine / テスター : jastaway 👑 みうね 👑 kencho tatesoto TKTYI kmmtkm butsurizuki
お気に入りにしたユーザー ProblemId : 12242 / 自分の提出
問題文最終更新日: 2025-05-23 19:00:33
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence. Back to the original
KCPC新歓杯 -Happy Birthday physics0523- (順位表) の他の問題:

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もしくは右上の雲マークをクリックしてアカウントを作成してください。