#C5699. Longest Increasing Hike

    ID: 49376 Type: Default 1000ms 256MiB

Longest Increasing Hike

Longest Increasing Hike

Given a sequence of mountain heights represented by integers, your task is to find the length of the longest contiguous subarray (hike) where every subsequent mountain is not lower than the previous one. In other words, you need to identify the maximum length subsequence \(a_i, a_{i+1}, \dots, a_j\) such that for every \(k\) with \(i < k \leq j\), \(a_k \ge a_{k-1}\). A single mountain is considered a valid hike of length 1.

inputFormat

The input consists of two lines. The first line contains an integer \(n\), denoting the number of mountain heights. The second line contains \(n\) space-separated integers representing the mountain heights.

outputFormat

Output a single integer, which is the length of the longest non-decreasing contiguous subarray of mountain heights.

## sample
6
1 2 2 3 5 4
5