fork download
  1.  
  2. #include <bits/stdc++.h>
  3. using namespace std;
  4. bool arrayasc(int a[], int n){
  5. for(int i=0;i<n-1;i++){
  6. if(a[i]>a[i+1]){
  7. return false;
  8. }
  9. }
  10. return true;
  11. }
  12. int main() {
  13. int z;
  14. cin>>z;
  15. while(z--){
  16. int n;
  17. cin>>n;
  18. int a[n];
  19. for(int i=0;i<n;i++){
  20. cin>>a[i];
  21. }
  22. bool temp = arrayasc(a,n);
  23. if(temp == false){
  24. cout<<"FALSE"<<"\n";
  25. }
  26. else{
  27. cout<<"TRUE"<<"\n";
  28. }
  29. }
  30. return 0;
  31. }
Success #stdin #stdout 0.01s 5544KB
stdin
1
3
1 5 6
stdout
TRUE