#C7241. Longest Non-Decreasing Subarray Length

    ID: 51091 Type: Default 1000ms 256MiB

Longest Non-Decreasing Subarray Length

Longest Non-Decreasing Subarray Length

You are given an array of integers representing prices. Your task is to determine the length of the longest contiguous subarray in which the prices are non-decreasing.

A subarray is a contiguous sequence of elements within the array. The subarray is non-decreasing if for every two consecutive elements a and b in the subarray, the inequality \(b \ge a\) holds.

For example, given the array [1, 2, 2, 1, 3, 4, 5], the longest such subarray is [1, 3, 4, 5] which has length 4.

If the input array is empty, output 0.

inputFormat

The first line of input contains a single integer \(n\) representing the number of elements in the array. If \(n = 0\), there are no further inputs.

The second line (when \(n > 0\)) contains \(n\) space-separated integers representing the prices.

outputFormat

Output a single integer denoting the length of the longest contiguous subarray that is non-decreasing.

## sample
7
1 2 2 1 3 4 5
4