Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int a[123];
- int main() {
- int n;
- scanf("%d", &n);
- for (int i = 1; i <= n; ++i) {
- scanf("%d", &a[i]);
- }
- int cntPeak = 0;
- for (int i = 1; i <= n; ++i) {
- int l = a[i-1], m = a[i], r = a[i+1];
- if (l == m) return printf("No\n"), 0;
- if (l < m and m > r)
- ++cntPeak;
- }
- printf("%s\n", cntPeak == 1 ? "Yes" : "No");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement