题目描述
Problem Description
Takahashi has data summarizing the heights of locations arranged in an east-west direction. The height of the $i$-th location from the west, $i\ (1 ≦ i ≦ N)$, is $h_i$. There are no locations with the same height in this data.
Takahashi decided to define "mountains" and "the size of a mountain" as follows:
For a triplet of integers $(s, t, u)\ (1 ≦ s ≦ t ≦ u ≦ N)$, it represents a mountain if the following conditions are satisfied:
- Condition for the west side of the mountain: For any integer $i$ satisfying $s ≦ i ≦ t-1$, $h_i < h_{i+1}$ holds.
- Condition for the east side of the mountain: For any integer $i$ satisfying $t ≦ i ≦ u-1$, $h_i > h_{i+1}$ holds.
For such a triplet $(s, t, u)$, the size of the mountain is defined as $u - s + 1$.
Takahashi decided to investigate what the maximum size of a mountain in the data is.
Create a program that calculates the maximum possible size of a mountain in the data.
Input Format
The input is given from the standard input in the following format:
$N$ $h_1$ $h_2$ : $h_N$
- The first line contains an integer $N\ (1 ≦ N ≦ 3×10^5)$, representing the number of elements in the data.
- The next $N$ lines contain integers representing the heights of the locations. The $i$-th line contains an integer $h_i\ (1 ≦ h_i ≦ 10^9)$.
- For any integers $i, j$ satisfying $1 ≦ i < j ≦ N$, $h_i ≠ h_j$.
Output Format
Output the maximum possible size of a mountain in one line. Ensure a newline at the end of the output.
Sample Input and Output
Sample Input #1
6
4
5
1
6
9
7
Sample Output #1
4
Sample Input #2
7
90
70
50
30
20
10
5
Sample Output #2
7
Notes/Hints
Partial Points
This problem has partial points.
- If you correctly solve the dataset where $N ≦ 20$, you will be awarded 30 points.
- If you correctly solve the dataset without additional constraints, you will be awarded an additional 70 points.
Sample Explanation 1
The mountain data is \[4, 5, 1, 6, 9, 7\]. Considering the triplet $(3, 5, 6)$:
- The condition for the west side of the mountain is satisfied because $1(=h_3) < 6(=h_4) < 9(=h_5)$.
- The condition for the east side of the mountain is satisfied because $9(=h_5) > 7(=h_6)$.
Thus, the triplet $(3, 5, 6)$ represents a mountain of size $6 - 3 + 1 = 4$. Since there are no mountains of size 5 or larger, the answer is 4.
输入格式
见题面 Input 部分
输出格式
见题面 Output 部分