| 시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
|---|---|---|---|---|---|
| 2 초 | 1024 MB | 37 | 13 | 10 | 34.483% |
You are given an array $a$ of $n$ positive integers numbered from $1$ to $n$. Let's call an array integral if for any two, not necessarily different, numbers $x$ and $y$ from this array, $x \ge y$, the number $\left \lfloor \frac{x}{y} \right \rfloor$ ($x$ divided by $y$ with rounding down) is also in this array.
You are guaranteed that all numbers in $a$ do not exceed $c$. 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 $n$ and $c$ ($1 \le n \le 10^6$, $1 \le c \le 10^7$) --- the size of $a$ and the limit for the numbers in the array.
The second line of each test case contains $n$ integers $a_1$, $a_2$, $\ldots$, $a_n$ ($1 \le a_i \le c$) --- the array $a$.
Let $N$ be the sum of $n$ over all test cases and $C$ be the sum of $c$ over all test cases. It is guaranteed that $N \le 10^6$ and $C \le 10^7$.
For each test case print Yes if the array is integral and No otherwise.
| 번호 | 배점 | 제한 |
|---|---|---|
| 1 | 13 | $N \le 100$ |
| 2 | 17 | $N \le 100\,000$, $C \le 10\,000$ |
| 3 | 15 | $N \le 1000$ |
| 4 | 27 | $N \le 100\,000$ |
| 5 | 28 |
3 3 5 1 2 5 4 10 1 3 3 7 1 2 2
Yes No No
In the first test case it is easy to see that the array is integral:
Thus, 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 $a$, that's why it is not integral.
In the third test case $\left \lfloor \frac{2}{2} \right \rfloor = 1$, but there is only $2$ in the array, that's why it is not integral.
Olympiad > Moscow Open Olympiad in Informatics > Moscow Open Olympiad in Informatics 2021-22 > Day 2 B번