Advertisement
Ankit_132

D

Feb 27th, 2024
906
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.56 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int main() {
  5.     int t;
  6.     cin>>t;
  7.    
  8.     while(t--){
  9.         int n;
  10.         cin>>n;
  11.        
  12.         vector<int> a(n);
  13.        
  14.         for(auto &e: a)         cin>>e;
  15.        
  16.         sort(a.begin(), a.end());
  17.        
  18.         if(a[0] != a[1])
  19.         {
  20.             cout<<"YES\n";
  21.             continue;
  22.         }
  23.        
  24.         int f = 0;
  25.        
  26.         for(auto e: a)
  27.             f += (e%a[0] > 0);
  28.            
  29.         if(f)       cout<<"YES\n";
  30.         else        cout<<"NO\n";
  31.     }
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement