F - Double Booking Editorial /

Time Limit: 2 sec / Memory Limit: 1024 MB

配点 : 7

注意

この問題に対する言及は、2021/7/17 18:00 JST まで禁止されています。言及がなされた場合、賠償が請求される可能性があります。 試験後に総合得点や認定級を公表するのは構いませんが、どの問題が解けたかなどの情報は発信しないようにお願いします。

問題文

あなたは N 件のオンラインミーティングに出席する予定があります。i 件目のミーティングは、今日から D_i 日後の S_i 時から T_i 時まで開催される予定です。
ミーティングの予定に重複があるかどうか判定してください。ただし、片方のミーティングの終了時刻ともう片方のミーティングの開始時刻が同じである場合は、重複と見なさないこととします。

制約

  • 入力は全て整数
  • 1 ≤ N ≤ 10^5
  • 1 ≤ D_i ≤ 10^5
  • 0 ≤ S_i < T_i ≤ 24

入力

入力は以下の形式で標準入力から与えられる。

N
D_1 S_1 T_1
D_2 S_2 T_2
\vdots
D_N S_N T_N

出力

ミーティングの予定に重複がある場合は Yes を、ない場合は No を出力せよ。


入力例 1

3
1 10 15
1 11 12
1 14 16

出力例 1

Yes

1 件目と 2 件目のミーティング、1 件目と 3 件目のミーティングが重複しています。


入力例 2

3
1 20 22
1 22 24
2 0 2

出力例 2

No

1 件目のミーティングの直後に 2 件目のミーティング、2 件目のミーティングの直後に 3 件目のミーティングがありますが、重複ではありません。


入力例 3

5
2 0 24
1 0 10
3 0 1
1 12 23
3 22 24

出力例 3

No

Score : 7 points

Warning

Do not make any mention of this problem until July 17, 2021, 6:00 p.m. JST. In case of violation, compensation may be demanded. After the examination, you can reveal your total score and grade to others, but nothing more (for example, which problems you solved).

Problem Statement

You have plans to attend N online meetings. The i-th meeting is scheduled to take place from S_i o'clock to T_i o'clock on the 24-hour clock D_i days later.
Determine whether some of these schedules are overlapping. Here, if a meeting starts exactly when another meeting ends, we do not consider them to be overlapping.

Constraints

  • All values in input are integers.
  • 1 ≤ N ≤ 10^5
  • 1 ≤ D_i ≤ 10^5
  • 0 ≤ S_i < T_i ≤ 24

Input

Input is given from Standard Input in the following format:

N
D_1 S_1 T_1
D_2 S_2 T_2
\vdots
D_N S_N T_N

Output

If some of these schedules are overlapping, print Yes; otherwise, print No.


Sample Input 1

3
1 10 15
1 11 12
1 14 16

Sample Output 1

Yes

The first and second meetings are overlapping, and so are the first and third meetings.


Sample Input 2

3
1 20 22
1 22 24
2 0 2

Sample Output 2

No

The first meeting is immediately followed by the second meeting, which is immediately followed by the third meeting, but we do not consider them to be overlapping.


Sample Input 3

5
2 0 24
1 0 10
3 0 1
1 12 23
3 22 24

Sample Output 3

No