fork download
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int main(){
  5. int t;
  6. cin >> t;
  7. for(int i=0;i<t;i++){
  8. int n,cyc = 0, mx = 0;
  9. cin >> n;
  10. int a[n];
  11. for(int j=0;j<n;j++){
  12. cin >> a[j];
  13. if(a[j] >= mx){
  14. mx = a[j];
  15. a[j] = 0;
  16. cyc++;
  17. }
  18. }
  19. //cout << cyc << endl;
  20. if(cyc % 2 == 0) {
  21. cout << "YES" << endl;
  22. } else {
  23. cout << "NO" << endl;
  24. }
  25. }
  26. return 0;
  27. }
Success #stdin #stdout 0s 5296KB
stdin
5
2
2 1
2
1 1
3
3 3 3
4
3 3 4 4
4
1 2 2 2
stdout
NO
YES
NO
YES
YES