Source Code
#include <iostream>
#include <vector>
#include <algorithm>
#define ll long long int
using namespace std;

int main() {
	ll n, height;
	vector<int> v;
	cin >> n;
	while (n--) {
		cin >> height;
		v.push_back(height);
	}
	if (is_sorted(v.begin(), v.end()))
		cout << "YES" << endl;
	else
		cout << "NO" << endl;
}
Copy
Anton Can't See (⊙︿⊙)_/¯ Rokii
GNU G++17
33 ms
1.6 MB
Accepted