101901: [AtCoder]ABC190 B - Magic 3

Memory Limit:256 MB Time Limit:2 S
Judge Style:Text Compare Creator:
Submit:5 Solved:0

Description

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.

Input

题意翻译

### 题目翻译 魔法使高桥正在和怪兽战斗。高桥可以使用 $N$ 类的咒语。第 $i$ 个咒语需要唱歌 $X_i$ 秒,威力为 $Y_i$。($i \in $ {${1,2,3...,n}$}) 但是,因为这个怪兽很强,所以歌唱需要 $S$ 秒及以上的咒语或威力在 $D$ 及以下的咒语都不能给予怪兽伤害。另外,也不能用咒语以外的方法给予怪兽伤害。 高桥能给予怪兽伤害吗? 如果能,请输出 yes,如果不行,请输出 no。 ### 输入格式 第一行 $3$ 个数:$N$,$S$ 和 $D$。后 $N$ 行,每行两个数,分别为 $X_i$ 和 $Y_i$。 ### 输出格式 一行,如果能给予怪兽伤害,请输出 yes,如果不行,请输出 no。 翻译提供者@[18974918693mzx](https://www.luogu.com.cn/user/602013)

加入题单

上一题 下一题 算法标签: