Submission
Status:
[PPP-][P][P][P][P]
Score: 80
User: Cmoss9
Problemset: นก
Language: cpp
Time: 0.002 second
Submitted On: 2025-03-27 15:07:57
#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++;
}
}
if (height[n-1] > height[n-2]) {
count++;
}
cout << count;
}