cswork / OA打开练习工作台

IBMOA #21

Find Length of Longest Bitonic Subarray

估计中等可在线判题

考点(AI 标注)动规入门双指针滑窗

Find the longest contiguous subarray whose elements are first non-decreasing and then non-increasing; either side may consist of only the peak element, and equal values are allowed.

输入格式

The first line contains n, and the second line contains n integers. 1≤n≤100000, 1≤element≤10^9.

输出格式

Output one integer, the answer.

样例 1

输入:

7
10 8 9 15 12 6 7

输出:

5

样例 2

输入:

6
5 1 2 1 4 5

输出:

3

样例 3

输入:

3
4 4 4

输出:

3

样例说明

The examples give 5, 3 and 3 respectively; equal elements may extend across the peak.