#5703. [OOI 2022] Integral Array
[OOI 2022] Integral Array
[OOI 2022] Integral Array
题目描述
CF1648BYou are given an array of positive integers numbered from to . Let's call an array if for any two, not necessarily different, numbers and from this array, , the number ( divided by with rounding down) is also in this array.
You are guaranteed that all numbers in do not exceed . Your task is to check whether this array is integral.
输入格式
The input consists of multiple test cases. The first line contains a single integer $t$ ($1 \le t \le 10\,000$) --- the number of test cases. Description of the test cases follows.The first line of each test case contains two integers and (, ) --- the size of and the limit for the numbers in the array.
The second line of each test case contains integers , , , () --- the array .
Let be the sum of over all test cases and be the sum of over all test cases. It is guaranteed that and .
输出格式
For each test case print $\texttt{Yes}$ if the array is integral and $\texttt{No}$ otherwise.3
3 5
1 2 5
4 10
1 3 3 7
1 2
2
Yes
No
No
提示
### Note In the first test case it is easy to see that the array is integral: - $\left \lfloor \frac{1}{1} \right \rfloor = 1$, $a_1 = 1$, this number occurs in the arry - $\left \lfloor \frac{2}{2} \right \rfloor = 1$ - $\left \lfloor \frac{5}{5} \right \rfloor = 1$ - $\left \lfloor \frac{2}{1} \right \rfloor = 2$, $a_2 = 2$, this number occurs in the array - $\left \lfloor \frac{5}{1} \right \rfloor = 5$, $a_3 = 5$, this number occurs in the array - $\left \lfloor \frac{5}{2} \right \rfloor = 2$, $a_2 = 2$, this number occurs in the arrayThus, the condition is met and the array is integral.
In the second test case it is enough to see that
$\left \lfloor \frac{7}{3} \right \rfloor = \left \lfloor 2\frac{1}{3} \right \rfloor = 2$, this number is not in , that's why it is not integral.
In the third test case , but there is only in the array, that's why it is not integral.
Scoring
Tests for this problem are divided into 7 groups. For each of the groups you earn points only if your solution passes all tests in this group and all tests in required groups.
| Group | Points | Additional constraints | < | Required groups | Comment |
|---|---|---|---|---|---|
| 0 | -- | -- | -- | Sample tests. | |
| 1 | 13 | 0 | |||
| 2 | 17 | ||||
| 3 | 15 | -- | 0, 1 | ||
| 4 | 27 | 0 -- 3 | |||
| 5 | 28 | -- | 0 -- 4 | ||
| 标签: P13546 | 2022 | Moscow Olympiad | |||