Submission

Status:
[-SSS][P][-][-][-]

Score: 20

User: Cmoss9

Problemset: นก

Language: cpp

Time: 0.003 second

Submitted On: 2025-03-27 15:06:27

#include <bits/stdc++.h>
using namespace std;
int main () {
    cin.tie(0) -> sync_with_stdio(0);
    int count = 0;
    int n;
    cin >> n;
    vector<int> height(n);
    for (int i = 0;i<n;i++) {
        cin >> height[i];
    }
    if (height[0] > height[1]) {
        count++;
    }
    for (int i = 1;i<n-1;i++) {
        if (height[i] > height[i+1] && height[i] > height[i-1]) {
            count++;
        }
    }
    cout << count;
}