#P1317. 低洼地
低洼地
Description
A sequence of numbers represents the ground profile’s elevation changes. The height values are integers, and adjacent heights are connected by straight line segments. Find and count how many low-lying depressions could hold water.
As shown: the elevation changes are .

Input Format
Two lines.
- Line 1: , the number of heights.
- Line 2: integers giving the ground profile heights, with the first and last equal to . height .
Output Format
A single integer: the number of depressions that can potentially hold water.
10
0 1 0 2 1 2 0 0 2 0
3
Hint
Translated by ChatGPT 5
京公网安备 11011102002149号