#C13635. Longest Rainfall Sequence

    ID: 43195 Type: Default 1000ms 256MiB

Longest Rainfall Sequence

Longest Rainfall Sequence

Given a sequence of rainfall measurements over a series of days and a threshold value \(T\), determine the longest continuous sequence of days where each day's rainfall is strictly greater than \(T\). Also, compute the total rainfall over that sequence.

If there is no day with rainfall greater than \(T\), the answer should be \(0\) for both the length and the total rainfall.

Problem Statement:

You are given a list of integers \(a_1, a_2, \ldots, a_n\) representing the rainfall amounts for \(n\) consecutive days and an integer threshold \(T\). Find the maximum length \(L\) of a contiguous subsequence for which every element is greater than \(T\), and also compute the sum \(S\) of the elements in that subsequence.

Note: If multiple subsequences have the same maximum length, only the first encountered is considered for the purpose of summing.

inputFormat

The first line contains two integers \(n\) and \(T\), where \(n\) is the number of days and \(T\) is the threshold.

The second line contains \(n\) space-separated integers representing the rainfall measurements for each day.

outputFormat

Output two integers: the length \(L\) of the longest continuous sequence of days where the rainfall exceeds \(T\), and the total rainfall \(S\) for that sequence. The two numbers should be separated by a space.

## sample
5 4
5 6 10 15 8
5 44