Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- typedef long long ll;
- typedef unsigned long long ull;
- #define vi vector<int>
- #define vll vector<ll>
- #define tests int t; cin >> t; while(t--)
- #define pb push_back
- using namespace std;
- int main() {
- ios_base::sync_with_stdio(false);
- cin.tie(NULL); cout.tie(NULL);
- tests {
- int n, c; cin >> n >> c;
- vi arr(c+1, 0);
- for(int i = 0; i < n; i++) {
- int x; cin >> x;
- arr[x] = x;
- }
- if(arr[1] == 0) {
- cout << "No\n";
- continue;
- }
- bool f = 1;
- for(int i = c-1; i >= 1; i--)
- if(arr[i] == 0) arr[i] = arr[i+1];
- for(int i = 2; i <= c; i++) {
- if(arr[i] == i) {
- for(int j = i; j <= c; j += i) {
- if(arr[j] && arr[j]/arr[arr[j]/i] != i) {
- f = 0;
- break;
- }
- }
- }
- }
- if(f) cout << "Yes\n";
- else cout << "No\n";
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement