#P13546. [OOI 2022] Integral Array

[OOI 2022] Integral Array

题目背景

CF1648B

题目描述

You are given an array aa of nn positive integers numbered from 11 to nn. Let's call an array integral\textit{integral} if for any two, not necessarily different, numbers xx and yy from this array, xyx \ge y, the number xy\left \lfloor \frac{x}{y} \right \rfloor (xx divided by yy with rounding down) is also in this array.

You are guaranteed that all numbers in aa do not exceed cc. Your task is to check whether this array is integral.

输入格式

The input consists of multiple test cases. The first line contains a single integer tt (1t100001 \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 nn and cc (1n1061 \le n \le 10^6, 1c1071 \le c \le 10^7) --- the size of aa and the limit for the numbers in the array.

The second line of each test case contains nn integers a1a_1, a2a_2, \ldots, ana_n (1aic1 \le a_i \le c) --- the array aa.

Let NN be the sum of nn over all test cases and CC be the sum of cc over all test cases. It is guaranteed that N106N \le 10^6 and C107C \le 10^7.

输出格式

For each test case print Yes\texttt{Yes} if the array is integral and No\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:

  • 11=1\left \lfloor \frac{1}{1} \right \rfloor = 1, a1=1a_1 = 1, this number occurs in the arry
  • 22=1\left \lfloor \frac{2}{2} \right \rfloor = 1
  • 55=1\left \lfloor \frac{5}{5} \right \rfloor = 1
  • 21=2\left \lfloor \frac{2}{1} \right \rfloor = 2, a2=2a_2 = 2, this number occurs in the array
  • 51=5\left \lfloor \frac{5}{1} \right \rfloor = 5, a3=5a_3 = 5, this number occurs in the array
  • 52=2\left \lfloor \frac{5}{2} \right \rfloor = 2, a2=2a_2 = 2, this number occurs in the array

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 aa, that's why it is not integral.

In the third test case 22=1\left \lfloor \frac{2}{2} \right \rfloor = 1, but there is only 22 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
NN CC
0 -- -- -- Sample tests.
1 13 N100N \le 100 0
2 17 N100000N \le 100\,000 C10000C \le 10\,000
3 15 N1000N \le 1000 -- 0, 1
4 27 N100000N \le 100\,000 0 -- 3
5 28 -- 0 -- 4