fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. void solve() {
  5. int n; cin >> n;
  6. vector<int> v(n);
  7. for(auto &x : v) cin >> x;
  8. cout << ((is_sorted(v.begin(), v.end())) ? "YES\n" : "NO\n");
  9. }
  10.  
  11. int main() {
  12. ios::sync_with_stdio(false);
  13. cin.tie(nullptr);
  14. int t; cin >> t;
  15. while(t--) solve();
  16. return 0;
  17. }
Success #stdin #stdout 0s 5316KB
stdin
3
5
2 4 6 7 10
8
1 100 101 120 120 121 1080 1080
4
100 1 102 12
stdout
YES
YES
NO