#C11640. Longest Warm Period

    ID: 40979 Type: Default 1000ms 256MiB

Longest Warm Period

Longest Warm Period

You are given a sequence of daily average temperatures and an integer threshold. Your task is to determine the length of the longest continuous period during which the temperature was strictly greater than the threshold. More formally, given an array of temperatures \(T = [t_1, t_2, \dots, t_n]\) and an integer \(\text{threshold}\), you must compute the maximum length \(L\) such that for some consecutive segment \(T[i, i+L-1]\), every temperature satisfies \(t_j > \text{threshold}\) for \(i \le j \le i+L-1\). If no day has a temperature greater than the threshold, the answer is 0.

Note: A temperature is considered above the threshold only if temperature > threshold (i.e. strictly greater).

inputFormat

The input is read from standard input (stdin) and consists of two lines:

  1. The first line contains two integers \(n\) and \(threshold\), where \(n\) is the number of days.
  2. The second line contains \(n\) space-separated integers representing the daily temperatures.

outputFormat

Output a single integer to standard output (stdout) — the length of the longest consecutive period during which the temperature was strictly greater than \(threshold\).

## sample
9 32
30 35 28 40 42 37 38 21 25
4