#OLD385. Maximum Consecutive Sequence
Maximum Consecutive Sequence
Description
Kiudou always asks questions in the online math forum , and sometimes answers other netizen's questions. He accumulated a good popularity in the forum, so he was lucky to be invited to the 8th MathCon conference.During the break, he strolled through the small shops of souvenirs. One of the items caught his attention. This is a small ribbon with a sequence of numbers, and the ribbon seems to consist of n numbers. He thinks that if the sequence of numbers is and at the same time is a 32-bit integer, and what the value of the maximum consecutive sequence is.
Format
Input
Input contains multiple cases.
For each case, the first line inputs an integer , and the second line inputs integers . Numbers are separated by spaces. The constraint is ,
Output
Print the sum of the maximum consecutive sequence, and the starting index and ending index of the sequence. If the maximum consecutive sequence is not unique, printing the smallest two index and .
If numbers are all negative, the sum is 0, the starting index is 0, and the ending index is the last index of the sequence.
Samples
4
1 -8 2 3
5 2 3