Problem
Input format
The first line contains two natural numbers `n` and `L` separated by a space. The second line contains `n` integers separated by spaces. - `1 <= L <= n <= 1000` - `-1000 <= v[i] <= 1000` - use the sliding-window technique for efficiency
Output format
Print two numbers separated by a space: the position of the first element of the maximum-sum window, and the value of that sum. The line ends with a newline character.
Example
6 3 1 2 3 4 5 6
4 15
Stuck?
Use the Get Hint button in the action bar to reveal a guided hint.
💬 Discussion
Loading...No comments yet. Be the first to start the discussion!
Sample cases (from the problem)
Sample Case 1
6 3 1 2 3 4 5 6
4 15
Solve it your way first
Community solutions unlock after you submit a passing solution. Don't peek.
Ready to solve this challenge?
Create a free account to write code, submit solutions, and track your progress.