

Time Limit: 3 sec / Memory Limit: 1024 MB
配点 : 点
問題文
個のテストケースについて、以下の問題を解いてください。
の番号がついた 個の箱と、 の番号がついた 個のボールがあります。
それぞれの箱に入れることのできるボールの個数は多くとも 個です。
以下の条件を満たすように、 個のボールを全て箱に入れることができるか判定してください。
- 全ての 以上 以下の整数 について、番号 のボールが 以上 以下の番号がついた箱に入っている。
制約
- つの入力に含まれるテストケースについて、それらの の総和は を超えない。
入力
入力は標準入力から与えられる。入力の 行目は以下の形式である。
その後、 個のテストケースが続く。各テストケースは以下の形式で与えられる。
出力
出力は 行からなる。
行目には、 番目に入力されたテストケースについて、問題文中の条件を満たすように 個のボールを全て箱に入れることができるなら Yes
、そうでないなら No
と出力せよ。
なお、正誤判定器は英大文字と英小文字を区別せず、どちらも受理する。
入力例 1Copy
2 3 1 2 2 3 3 3 5 1 2 2 3 3 3 1 3 999999999 1000000000
出力例 1Copy
Yes No
この入力には つのテストケースが含まれます。
-
つ目のテストケースについて、以下のようにボールを箱に入れると、問題文中の条件を満たすように 個のボールを全て箱に入れることができるので、
Yes
と出力します。- ボール を箱 に入れる。
- ボール を箱 に入れる。
- ボール を箱 に入れる。
-
つ目のテストケースについて、問題文中の条件を満たすように 個のボールを全て箱に入れることはできないので、
No
と出力します。
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.
Sample Input 1Copy
2 3 1 2 2 3 3 3 5 1 2 2 3 3 3 1 3 999999999 1000000000
Sample Output 1Copy
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
.