Ankit_132

A

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