B - Magic 3 Editorial /

Time Limit: 2 sec / Memory Limit: 1024 MB

配点 : 200

問題文

魔法使いの高橋君は魔物と戦っています。
高橋君は N 種類の呪文を使うことができます。 i 番目の呪文は詠唱に X_i 秒かかり、威力は Y_i です。
ただし、この魔物は強いので、詠唱に S 秒以上かかる呪文や、威力が D 以下の呪文ではダメージを与えられません。 また、呪文以外の方法でダメージを与えることもできません。
高橋君は魔物にダメージを与えられるでしょうか?

制約

  • 入力は全て整数
  • 1 ≤ N ≤ 100
  • 1 ≤ X_i ≤ 10^9
  • 1 ≤ Y_i ≤ 10^9
  • 1 ≤ S ≤ 10^9
  • 1 ≤ D ≤ 10^9

入力

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

N S D
X_1 Y_1
\vdots
X_N Y_N

出力

魔物にダメージを与えられるならば Yes を、与えられないならば No を出力せよ。


入力例 1

4 9 9
5 5
15 5
5 15
15 15

出力例 1

Yes

2, 4 番目の呪文は詠唱の時間が長いためダメージを与えられません。
また、 1, 2 番目の呪文は威力が足りないためダメージを与えられません。
したがって、3 番目の呪文でのみダメージを与えられます。


入力例 2

3 691 273
691 997
593 273
691 273

出力例 2

No

入力例 3

7 100 100
10 11
12 67
192 79
154 197
142 158
20 25
17 108

出力例 3

Yes

7 番目の呪文でのみダメージを与えられます。

Score : 200 points

Problem Statement

Takahashi, the magician, is fighting with a monster.
He can use N spells.
The i-th spell takes X_i seconds to cast and has a power Y_i.
However, the monster is strong enough to avoid taking damage from spells taking S or more seconds to cast and spells with powers D or less.
Also, there is nothing other than spells that can do damage to the monster.
Can Takahashi do damage to the monster?

Constraints

  • All values in input are integers.
  • 1 ≤ N ≤ 100
  • 1 ≤ X_i ≤ 10^9
  • 1 ≤ Y_i ≤ 10^9
  • 1 ≤ S ≤ 10^9
  • 1 ≤ D ≤ 10^9

Input

Input is given from Standard Input in the following format:

N S D
X_1 Y_1
\vdots
X_N Y_N

Output

If Takahashi can do damage to the monster, print Yes; otherwise, print No.


Sample Input 1

4 9 9
5 5
15 5
5 15
15 15

Sample Output 1

Yes

The second and fourth spells take too much time to do damage.
Also, the first and second spells do not have enough powers to do damage.
Thus, only the third spell can do damage.


Sample Input 2

3 691 273
691 997
593 273
691 273

Sample Output 2

No

Sample Input 3

7 100 100
10 11
12 67
192 79
154 197
142 158
20 25
17 108

Sample Output 3

Yes

Only the seventh spell can do damage.