Source Code
/******************************************************************************

Welcome to GDB Online.
GDB online is an online compiler and debugger tool for C, C++, Python, Java, PHP, Ruby, Perl,
C#, VB, Swift, Pascal, Fortran, Haskell, Objective-C, Assembly, HTML, CSS, JS, SQLite, Prolog.
Code, Compile, Run and Debug online from anywhere in world.

*******************************************************************************/
#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=1;i<n;i++){
        if(arr[i] <= arr[i+1]){
            continue;
        }else{
            cout<<"NO"<<endl;
            return 0;
        }
    }
    cout<<"YES";
    
    return 0;
}
Copy
Anton Can't See (⊙︿⊙)_/¯ sharawi
GNU G++17
21 ms
1.4 MB
Wrong Answer