Source Code
#include <iostream>

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 (⊙︿⊙)_/¯ Mohamedmaher
GNU G++17
40 ms
1.5 MB
Accepted