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 = 1; i < n - 1; i++) {
		if (vec[i] > vec[i + 1] && vec[i + 1] >= vec[0]) {
			cout << "NO" << endl;
			system("pause");
			return 0;
		}
	}
	cout << "YES" << endl;
	system("pause");
}
Copy
Anton Can't See (⊙︿⊙)_/¯ psutMoha
GNU G++17
41 ms
1.7 MB
Wrong Answer