Logo
(追記) (追記ここまで)

21248번 - Bloodseeker 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 512 MB276635.294%

문제

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".

제한

예제 입력 1

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

예제 출력 1

YES
NO
YES
NO

힌트

출처

Contest > Open Cup > 2020/2021 Season > Stage 8: Grand Prix of Samara K번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /