#C5334. Longest Sequence Above Temperature Threshold

    ID: 48972 Type: Default 1000ms 256MiB

Longest Sequence Above Temperature Threshold

Longest Sequence Above Temperature Threshold

In this problem, you are given several test cases. For each test case, you need to determine the longest sequence of consecutive days during which the temperature is strictly greater than a given threshold. Formally, for a sequence of temperatures T1, T2, (\ldots), TN and a threshold (K), you are to compute the maximum length (L) such that there exists an index (i) with (T_i > K, T_{i+1} > K, \ldots, T_{i+L-1} > K).

For example, given N = 7, K = 30, and the list of temperatures [31, 32, 33, 29, 28, 30, 31], the longest sequence has a length of 3 (the sequence 31, 32, 33).

inputFormat

The input begins with an integer (T) ( (1 \leq T \leq 100)) representing the number of test cases. For each test case:

  • The first line contains two integers (N) and (K) where (N) is the number of days ( (1 \leq N \leq 10^5)) and (K) is the temperature threshold.
  • The second line contains (N) space-separated integers indicating the temperatures for each day.

outputFormat

For each test case, output a single integer on a new line representing the length of the longest sequence of consecutive days where the temperature is strictly greater than (K).## sample

2
7 30
31 32 33 29 28 30 31
5 10
11 12 9 14 15
3

2

</p>