#K55637. Maximum Sublist Sum
Maximum Sublist Sum
Maximum Sublist Sum
You are given a list of integers. Your task is to find a contiguous subarray (sublist) that yields the maximum possible sum. In addition, you must output the start and end indices (1-based) of this subarray. If multiple subarrays yield the same maximum sum, choose the one with the smallest start index.
If the input list is empty, the output should be 0 0 0.
The mathematical formulation of the problem is to find indices \(i\) and \(j\) (with \(1 \le i \le j \le n\)) such that \[ S = \sum_{k=i}^{j} a_k \] is maximized.
This problem can be efficiently solved using Kadane's algorithm.
inputFormat
The first line of input contains an integer \(n\) indicating the number of elements in the list. If \(n > 0\), the second line contains \(n\) space-separated integers representing the list.
If \(n = 0\), there will be no second line.
outputFormat
Output three space-separated integers: the maximum sublist sum, the 1-based start index, and the 1-based end index of the sublist that produces this sum.
If the list is empty, output 0 0 0.
## sample9
-2 1 -3 4 -1 2 1 -5 4
6 4 7
</p>