Find the best 7 days of the season
An online sneaker store in Lagos wants to know which stretch of consecutive days earned the most money, so the marketing team can repeat what worked. They have one sales figure per day.
Task: the first line holds two integers n and k (1 ≤ k ≤ n ≤ 300). The second line holds n daily sales figures (integers from 0 to 100000). Consider every window of k consecutive days. Print one line with two integers separated by a space: the 1-based day number where the best window starts and the total sales of that window. If several windows tie for the best total, report the one that starts earliest.
Sample test
Input
10 3 5 1 9 2 8 8 1 0 7 7
Expected output
3 19
Your answer is also checked against 4 hidden tests.
Need a hint?
When the window slides one day, one figure enters and one leaves. You do not need to re-add all k numbers.
Log in or create a free account to run your code, submit and earn points.
Run your code to see the output here. Ctrl + Enter also runs it.
