Source Code
#include <iostream>
using namespace std;

int main() {
	int N, person, before = 0;
	cin >> N;
	if (N == 1) {
		cout << "YES";
		return 0;
	}
	while (N--) {
		cin >> person;
		if (before > person) {
			cout << "NO";
			return 0;
		}
		before = person;
	}
	
	cout << "YES";
}
Copy
Anton Can't See (⊙︿⊙)_/¯ Dana
GNU G++17
27 ms
924 KB
Accepted