Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- int main()
- {
- int n;
- scanf("%d", &n);
- bool down = false, fail = false;
- int v = 0;
- for (int i = 0; i < n && !fail; ++i) {
- int x;
- scanf("%d", &x);
- if (x == v) {
- fail = true;
- } else if (x > v) {
- if (down)
- fail = true;
- } else { // x < v
- down = true;
- }
- v = x;
- }
- if (fail)
- printf("No\n");
- else
- printf("Yes\n");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement