fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. #define ll long long
  4. const int N = 2e5+7;
  5. ll arr[N];
  6. int main() {
  7. int t;
  8. cin>>t;
  9. while(t--){
  10. int n;
  11. cin>>n;
  12. ll mini = 1e9;
  13. for(int i=0; i<n;i++){
  14. cin>>arr[i];
  15. mini=min(mini, arr[i]);
  16. }
  17. if(mini == arr[0]){
  18. cout<<"YES"<<endl;
  19. } else {
  20. cout<<"NO"<<endl;
  21. }
  22. }
  23. return 0;
  24. }
Success #stdin #stdout 0.01s 5280KB
stdin
6
3
1 2 3
5
1 3 2 5 4
5
5 4 3 2 1
3
3 1 2
4
2 3 1 4
5
5 1 2 3 4
stdout
YES
YES
NO
NO
NO
NO