Integral Array
시간 제한2초메모리 제한1024 MB
양의 정수 배열이 주어질 때, 임의의 두 원소 x, y(x≥y)에 대해 x를 y로 나눈 몫의 내림값도 배열 안에 존재하는지 판정한다. n의 합은 10^6, c의 합은 10^7까지 커질 수 있다.
문제
You are given an array of positive integers numbered from to . Let's call an array integral 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 () --- 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 Yes if the array is integral and No otherwise.
힌트
In the first test case it is easy to see that the array is integral:
- , , this number occurs in the arry
- , , this number occurs in the array
- , , this number occurs in the array
- , , 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
, 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.