시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
---|---|---|---|---|---|
2 초 | 512 MB | 13 | 4 | 4 | 40.000% |
Bloodseeker is facing $n$ enemies. At the beginning, he has $m$ hit-points, and every second his hit-points are decreased by $1$. If his hit-points become $0$, he dies. But he can kill the enemies to regenerate his hit-points.
The $i$-th enemy is to be hit $t_i$ times to kill. Bloodseeker makes one hit per second. Every second, he is able to hit any enemy. After the $i$-th enemy receives a last hit, Bloodseeker regenerates $h_i$ hit-points (but his hit-points can't become greater than $m$). Note that if Bloodseeker had $1$ hit-point before he last-hits the $i$-th enemy, he doesn't die.
Can Bloodseeker kill all enemies?
The first line contains an integer $T$ ($1 \le T \le 200000$) --- the number of test cases.
The first line of each test case contains two integers $n$ and $m$ ($1 \le n \le 200000, 1 \le m \le 10^9$) --- the number of enemies and the maximal Bloodseeker's hit-points.
Each of the next $n$ lines in each test case contains two integers $t_i$ and $h_i$ ($1 \le t_i, h_i \le 10^9$) --- the time required for killing the $i$-th enemy and the number of hit-points regenerated after it.
It is guaranteed that the sum of all $n$ does not exceed $200000$.
For each test case, if it's possible to kill all the enemies, output "YES
", otherwise output "NO
".
4 2 10 7 3 6 1 2 10 7 3 7 1 3 10 5 7 5 7 14 1 3 10 5 7 5 7 15 1
YES NO YES NO