Time Limit: 10 minutes

Find a maximum sum of a compact subsequence of array elements.

A non-empty array A consisting of N integers is given. A pair of integers (P, Q), such that `0 ≤ P ≤ Q < N`

, is called a slice of array A. The sum of a slice (P, Q) is the total of `A[P] + A[P+1] + ... + A[Q]`

.

Time Limit: 10 minutes

Find a maximum sum of a compact subsequence of array elements.

A non-empty array A consisting of N integers is given. A pair of integers (P, Q), such that `0 ≤ P ≤ Q < N`

, is called a slice of array A. The sum of a slice (P, Q) is the total of `A[P] + A[P+1] + ... + A[Q]`

.