Source Code
#include <bits/stdc++.h>
using namespace std;

void solve()
{
int n;
cin>>n;

int a[n];

for(int i=0 ; i<n ; i++)
{
	cin>>a[i];
}

for(int i=0 ; i<n-1 ; i++)
{
	if(a[i]>a[i+1])
	{
		cout<<"NO";
		return;
	}
}

printf("YES");
}

int main() {
	int t=1;
	//cin>>t;
	while(t--)
	{
		solve();
		cout<<endl;
	}
	return 0;
}

Copy
Anton Can't See (⊙︿⊙)_/¯ TATAKAE
GNU G++17
45 ms
952 KB
Accepted