Submission

Status:

[PPPP][P][P][P][P]

Subtask/Task Score:

{20/20}{20/20}{20/20}{20/20}{20/20}

Score: 100

User: fienicl

Problemset: นก

Language: cpp

Time: 0.002 second

Submitted On: 2026-09-27 22:13:26

#include <iostream>
using namespace std;

int main(){
	int n, count = 0;
	cin >> n;
	int a[n];
	for(int i = 0 ; i < n; ++i){
		cin >> a[i];
	}
	for(int i = 0; i < n; ++i){
		if(i == 0){
			if(a[i] > a[i+1]){
				++count;
			}
		}
		else if(i > 0 and i < n-1){
			if(a[i] > a[i+1] and a[i] > a[i-1]){
				++count;
			}
		}
		else{
			if(a[i] > a[i-1]){
				++count;
			}
		}
	}
	cout << count;
}