fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. typedef long long ll;
  4.  
  5. void sorting(vector<int>& a){
  6. sort(a.begin(),a.end());
  7. }
  8. int main() {
  9. ios_base::sync_with_stdio(0);
  10. cin.tie(0);
  11. ll t;
  12. cin>>t;
  13.  
  14. for(int i=0;i<t;i++){
  15. ll n;
  16. cin>>n;
  17. vector<int> a(n);
  18. vector<int> b(n);
  19. for(int j=0;j<n;j++){
  20. cin>>a[j];
  21. b[j]=a[j];
  22. }
  23.  
  24. sorting(a);
  25. reverse(a.begin(),a.end());
  26. if(b==a){
  27. cout<<"TRUE"<<"\n";
  28. }
  29. else{
  30. cout<<"FALSE"<<"\n";
  31. }
  32. }
  33.  
  34. return 0;
  35. }
Success #stdin #stdout 0.01s 5428KB
stdin
2
4
5 6 7 8
3
3 2 1
stdout
FALSE
TRUE