Source Code
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;

int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    
    int n;
    cin>>n;

    vector<int>a(n);
    for(auto &x:a) cin>>x;

    if(is_sorted(a.begin(),a.end())){
        cout<<"YES";
    } else {
        cout<<"NO";
    }
}
Copy
Anton Can't See (⊙︿⊙)_/¯ YazanIstatiyeh
GNU G++17
11 ms
1.0 MB
Accepted