P6181 [USACO10OPEN] Mountain Watching S
Description
One day, Bessie looked at the distant mountain range and wondered, "Which mountain is the widest?"
Bessie managed to measure the heights $h_i$ at $N$ positions ($1 \leq N \leq 10^5$, $1 \leq h_i \leq 10^9$). A mountain is defined as a subsequence whose heights first do not decrease, and then do not increase. The mountains at the edges of the view will only increase or only decrease in height. The width of a mountain is defined as the number of positions included in that mountain.
Here is an example:
```plain
******* *
********* ***
********** *****
*********** ********* *
* ***************** *********** *** *
** ******************* ************* * * ******* *
**********************************************************************
3211112333677777776543332111112344456765432111212111112343232111111211
aaaaaa ccccccccccccccccccccc eeeeeee ggggggggg
bbbbbbbbbbbbbbbbbbbbbbbbbbbb ddddd ffffffffff hhhhhhhhh
```
Each mountain has been labeled with a letter. Here, mountain `b` has the largest width, which is $28$.
Input Format
The first line contains an integer $N$.
The next $N$ lines each contain an integer $h_i$.
Output Format
Output the width of the widest mountain.
Explanation/Hint
**Sample Explanation**
At the widest mountain, the measured heights are $2, 3, 5, 4, 1$. Other mountains include $3, 2$ and $1, 6$.
---
**Hint**
If you know the highest part of a mountain (that is, the peak), you will find that it is very easy to determine the width of the mountain.
Translated by ChatGPT 5