#K37717. Consecutive Rainfall Days
Consecutive Rainfall Days
Consecutive Rainfall Days
You are given the number of days n, a threshold value t, and a list of rainfall amounts for each day. Your task is to determine the first pair of consecutive days such that their total rainfall is strictly greater than t. Days are 1-indexed. If no such pair exists, output -1.
Note: Use 1-indexing for the day numbers. The input is provided through standard input and the output should be printed to standard output.
Formally, given the rainfall amounts \(r_1, r_2, \dots, r_n\), find the smallest index \(i\) (with \(1 \leq i t\). If such an index does not exist, output -1.
inputFormat
The first line contains two integers, n
(the number of days) and t
(the threshold value). The next line contains n
space-separated integers representing the rainfall amounts for each day.
Example:
5 15 4 8 10 2 7
outputFormat
If a valid pair of consecutive days exists, print their 1-indexed positions separated by a space. Otherwise, print -1
.
Example Output:
2 3## sample
5 15
4 8 10 2 7
2 3