Source Code
#include <iostream>
#include <algorithm>
using namespace std;

int main()
{
    long long n;
    cin>>n;
    long long arr[n];
    for(long long  i=0;i<n;i++){
        cin>>arr[i];
    }
    for(long long i=0;i<n - 1;i++){
        if(arr[i]  > arr[i+1]){
            cout<<"NO"<<endl;
            return 0;
        }
    }
    cout<<"YES"<<endl;
    
    return 0;
}
Copy
Anton Can't See (⊙︿⊙)_/¯ sharawi
GNU G++17
31 ms
1.6 MB
Accepted