-->
当前位置:首页 > 题库

PROGRAMMING:Monster Fighting

Luz5年前 (2021-05-10)题库456
In the Game World, we all know the common scene, if you want to make your heroes stronger, you need to defeat monsters and upgrade yourselves.
Little Gyro is also a computer game fan. In a computer game *Monster Fighting*, Little Gyro need to defeat against $$n$$ monsters (numbered from 1 to $$n$$). Little Gyro's hero has an initial health $$m$$. In order to defeat the $$i$$-th monster, Little Gyro will lose $$a_ i$$ HP (Health Penalty), However, the monster will drop a blood bottle for Little Gyro to restore $$d_ i$$ HP. During the game of *Monster Fighting*, your health cannot be reduced to 0 or below.
Given the HP values $$a_ i$$, $$d_ i$$ for each monster, Little Gyro wants to know whether there exists a certain order that Little Gyro can defeat all the monsters.
### Input Specification:
There are multiple test cases. The first line of the input contains an integer $$T$$, indicating the number of test cases. For each test case:
The first line contains two integers $$n$$, $$m$$ (1 ≤ $$n$$, $$m$$ ≤ $$10^5$$), indicating the number of the monsters and the initial health of Little Gyro's hero.
In the following $$n$$ lines, each line contains   two   integers $$a_ i$$, $$d_ i$$ (1 ≤ $$a_ i$$, $$d_ i$$ ≤ $$10^5$$), indicating the HP values that Little Gyro lose and gain when fighting against the $$i$$-th monster.
It's guaranteed that the sum of   n   of all test cases will not exceed $$10^6$$.
### Output Specification:
For each test case, if Little Gyro can defeat all the monsters within a certain order, print "Yes" (without quotes), otherwise, print "No" (without quotes) instead.
### Sample Input:
```in
two
3 4
1 2
3 4
4 5
1 1
2 1
```
### Sample Output:
```out
Yes
No
```







answer:If there is no answer, please comment