#P9556. [SDCPC 2023] Orders
[SDCPC 2023] Orders
题目描述
A factory receives orders at the beginning of day . The -th order can be described as two integers and , indicating that at the end of day , the factory needs to deliver products to the customer.
Given that the factory can produce products each day, and at the beginning of day 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 () indicating the number of test cases. For each test case:
The first line contains two integers and (, ) indicating the number of orders and the number of products the factory can produce each day.
For the following lines, the -th line contains two integers and () indicating that the -th order require the factory to deliver products at the end of day .
输出格式
For each test case output one line. If the factory can complete all orders output , otherwise output .
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 products each day.
- At the end of day , there are products in stock so the factory can complete the -nd order. After delivery, there are products left in stock.
- At the end of day , the factory produces more products. There are products in stock so the factory can complete the -st and the -rd order. After delivery, there are products left in stock.
- At the end of day , the factory produces more products. There are products in stock so the factory can complete the -th order. After delivery, there are products left in stock.
For the second sample test case, the factory can produce products each day.
- At the end of day , there are products in stock and the factory can complete the -st order. After delivery, there are products left in stock.
- At the end of day , the factory produces more products. There are only products in stock so the factory cannot complete the -nd order.
