/
Time Limit: 2 sec / Memory Limit: 1024 MiB
配点 : 300 点
問題文
高橋君は山道をハイキングしています。山道には N 個の地点が一列に並んでおり、i 番目(1 \leq i \leq N)の地点の標高は A_i です。
高橋君は、連続する 1 個以上の地点からなる区間のうち、標高が広義単調増加(非減少)であるものを「登り坂」と呼んでいます。すなわち、l 番目から r 番目(1 \leq l \leq r \leq N)までの地点からなる区間が「登り坂」であるとは、すべての l \leq i \leq r-1 について A_i \leq A_{i+1} が成り立つことを意味します。特に、地点が 1 個だけの区間(l = r)も「登り坂」です。
この山道の中で、含まれる地点の数が最大である「登り坂」を求め、その地点の数を出力してください。
制約
- 1 \leq N \leq 10^5
- 1 \leq A_i \leq 10^9
- 入力はすべて整数である。
入力
N A_1 A_2 : A_N
- 1 行目には、地点の数を表す整数 N が与えられる。
- 続く N 行の j 行目(1 \leq j \leq N)には、j 番目の地点の標高を表す整数 A_j が与えられる。
出力
含まれる地点の数が最大である「登り坂」の地点の数を 1 行で出力してください。
入力例 1
6 1 2 2 1 3 4
出力例 1
3
入力例 2
5 9 7 5 3 1
出力例 2
1
入力例 3
12 5 6 6 7 3 4 8 8 9 2 2 3
出力例 3
5
入力例 4
30 8 9 9 10 7 7 8 12 12 13 5 6 7 8 9 3 3 4 4 4 10 11 2 2 2 3 1 5 6 7
出力例 4
7
入力例 5
1 1000000000
出力例 5
1
Score : 300 pts
Problem Statement
Takahashi is hiking along a mountain trail. There are N points lined up in a row along the trail, and the elevation of the i-th point (1 \leq i \leq N) is A_i.
Takahashi calls a contiguous interval of one or more points an "uphill" if the elevations are non-decreasing. That is, an interval from the l-th to the r-th point (1 \leq l \leq r \leq N) is an "uphill" if A_i \leq A_{i+1} holds for all l \leq i \leq r-1. In particular, an interval consisting of only one point (l = r) is also an "uphill".
Find the "uphill" that contains the maximum number of points along this mountain trail, and output that number of points.
Constraints
- 1 \leq N \leq 10^5
- 1 \leq A_i \leq 10^9
- All inputs are integers.
Input
N A_1 A_2 : A_N
- The first line contains an integer N representing the number of points.
- The j-th line (1 \leq j \leq N) of the following N lines contains an integer A_j representing the elevation of the j-th point.
Output
Output in one line the number of points in the "uphill" that contains the maximum number of points.
Sample Input 1
6 1 2 2 1 3 4
Sample Output 1
3
Sample Input 2
5 9 7 5 3 1
Sample Output 2
1
Sample Input 3
12 5 6 6 7 3 4 8 8 9 2 2 3
Sample Output 3
5
Sample Input 4
30 8 9 9 10 7 7 8 12 12 13 5 6 7 8 9 3 3 4 4 4 10 11 2 2 2 3 1 5 6 7
Sample Output 4
7
Sample Input 5
1 1000000000
Sample Output 5
1