#C3500. Longest Non-Decreasing Temperature Sequence

    ID: 46935 Type: Default 1000ms 256MiB

Longest Non-Decreasing Temperature Sequence

Longest Non-Decreasing Temperature Sequence

Given a sequence of daily temperatures, your task is to find the length of the longest contiguous sequence in which the temperatures are non-decreasing. In other words, for a given list of integers \(T = [T_1, T_2, \dots, T_n]\), determine the maximum integer \(L\) such that there exists an index \(i\) with \(T_i \leq T_{i+1} \leq \dots \leq T_{i+L-1}\). For example, if the input temperatures are 1 2 2 3 2 4 5 5, the longest non-decreasing segment is [1, 2, 2, 3] with a length of 4.

inputFormat

The first line contains an integer \(n\), the number of days. The second line contains \(n\) space-separated integers representing the daily temperatures. If \(n = 0\), the second line will be empty.

outputFormat

Output a single integer: the length of the longest contiguous subsequence of non-decreasing temperatures.

## sample
8
1 2 2 3 2 4 5 5
4

</p>