Advertisement
Ankit_132

B

Apr 17th, 2024
429
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.38 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.         for(auto &e: a)
  14.             cin>>e;
  15.            
  16.         int mmin = *min_element(a.begin(), a.end());
  17.        
  18.         if(a[0]>mmin || a[n-1]>mmin)        cout<<"NO\n";
  19.         else                                cout<<"YES\n";
  20.     }
  21. }
  22.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement