#abc214e. E - Packing Under Range Regulations
E - Packing Under Range Regulations
Score : points
问题描述
对于 个测试用例,解决以下问题。
有 个编号为 的盒子和 个编号为 的球。
每个盒子最多只能容纳一个球。
确定是否有可能将所有 个球放入盒子中,使得满足以下条件:
- 对于从 到 的每个整数 ,编号为 的球位于编号在 和 (包含)之间的盒子里。
以上为通义千问 qwen-max 翻译,仅供参考。
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.
Sample Input 1
2
3
1 2
2 3
3 3
5
1 2
2 3
3 3
1 3
999999999 1000000000
Sample Output 1
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
.
update @ 2024/3/10 09:31:44