Source Code
#include <iostream>
#include <vector>

using namespace std;

int main() {
	int n;
	cin >> n;
	vector<int> vec;
	int t;
	for (int i = 0; i < n; i++) {
		cin >> t;
		vec.push_back(t);
	}
	for (int i = 0; i < n - 1; i++) {
		if (vec[i] > vec[i + 1]) {
			cout << "NO" << endl;
			
			return 0;
		}
	}
	cout << "YES" << endl;
}
Copy
Anton Can't See (⊙︿⊙)_/¯ psutMoha
GNU G++17
30 ms
1.4 MB
Accepted