100 atcoder#ABC214E. [ABC214E] Packing Under Range Regulations
[ABC214E] Packing Under Range Regulations
Score : points
Problem Statement
Solve the following problem for test cases.
There are boxes numbered and balls numbered . Each box can contain at most one ball. Determine whether it is possible to put all balls in the boxes so that the following condition will be satisfied.
- For each integer from through , the ball numbered is in a box numbered between and (inclusive).
Constraints
- The sum of across the test cases in one input is at most .
Input
Input is given from Standard Input. The first line is in the following format:
Then, test cases follows, each of which is in the following format:
Output
Your output should have lines.
In the -th line, print Yes
if it is possible to put all balls in the boxes so that the condition will be satisfied in the -th test case in the input, and printNo
otherwise.
The checker is case-insensitive; it will accept both uppercase and lowercase letters.
2
3
1 2
2 3
3 3
5
1 2
2 3
3 3
1 3
999999999 1000000000
Yes
No
This input contains two test cases.
- In the -st test case, the following way to put the three balls would satisfy the condition, so we should print
Yes
.- Put Ball in Box .
- Put Ball in Box .
- Put Ball in Box .
- In the -nd test case, there is no way to put the five balls to satisfy the condition, so we should print
No
.