Submission
Status:
[PPPP][P][P][P][P]
Score: 100
User: ShynyC
Problemset: นก
Language: cpp
Time: 0.003 second
Submitted On: 2025-03-31 21:49:40
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int main(){
int n,h,count = 0;
cin >> n;
vector<int> height;
for(int i = 0; i < n; i++){
cin >> h;
height.push_back(h);
}
for(int i = 0; i < n; i++){
if(i == 0){
if(height[i] > height[i+1]){
count++;
}
}else if(i == n-1){
if(height[i] > height[i-1]){
count++;
}
}else{
if(height[i] > height[i+1] && height[i] > height[i-1]){
count++;
}
}
}
cout << count;
}