Source Code
#include <iostream>
using namespace std;

int main() {
	int n;
	cin>>n;
	int a[n];
  	for(int i=0;i<n;i++){
	    cin>>a[i];
	}
  bool flag=false;
  
	for(int i=0;i<n-1;i++){
	  if(a[i]>a[i+1]){
      flag=true;
      break;
    }
	}
  
  cout<<endl;
  if(flag)
	  cout<<"NO";
  else 
    cout<<"YES";
	return 0;
}
Copy
Anton Can't See (⊙︿⊙)_/¯ OmarQuishawi
GNU G++17
3 ms
232 KB
Wrong Answer