#P9556. [SDCPC 2023] Orders

[SDCPC 2023] Orders

题目描述

A factory receives nn orders at the beginning of day 11. The ii-th order can be described as two integers aia_i and bib_i, indicating that at the end of day aia_i, the factory needs to deliver bib_i products to the customer.

Given that the factory can produce kk products each day, and at the beginning of day 11 the factory has no product in stock, can the factory complete all orders?

输入格式

There are multiple test cases. The first line of the input contains an integer TT (1T1001 \le T \le 100) indicating the number of test cases. For each test case:

The first line contains two integers nn and kk (1n1001 \le n \le 100, 1k1091 \le k \le 10^9) indicating the number of orders and the number of products the factory can produce each day.

For the following nn lines, the ii-th line contains two integers aia_i and bib_i (1ai,bi1091 \le a_i, b_i \le 10^9) indicating that the ii-th order require the factory to deliver bib_i products at the end of day aia_i.

输出格式

For each test case output one line. If the factory can complete all orders output Yes\texttt{Yes}, otherwise output No\texttt{No}.

2
4 5
6 12
1 3
6 15
8 1
3 100
3 200
4 300
6 100
Yes
No

提示

For the first sample test case, the factory can produce 55 products each day.

  • At the end of day 11, there are 55 products in stock so the factory can complete the 22-nd order. After delivery, there are 22 products left in stock.
  • At the end of day 66, the factory produces 2525 more products. There are 2727 products in stock so the factory can complete the 11-st and the 33-rd order. After delivery, there are 00 products left in stock.
  • At the end of day 88, the factory produces 1010 more products. There are 1010 products in stock so the factory can complete the 44-th order. After delivery, there are 99 products left in stock.

For the second sample test case, the factory can produce 100100 products each day.

  • At the end of day 33, there are 300300 products in stock and the factory can complete the 11-st order. After delivery, there are 100100 products left in stock.
  • At the end of day 44, the factory produces 100100 more products. There are only 200200 products in stock so the factory cannot complete the 22-nd order.