#P11042. [2016杭电多校]Divide the Sequence
[2016杭电多校]Divide the Sequence
Divide the Sequence
Problem Description
Alice has a sequence A, She wants to split A into as much as possible continuous subsequences, satisfying that for each subsequence, every its prefix sum is not small than 0.
Input
The input consists of multiple test cases. Each test case begin with an integer n in a single line. The next line contains integers . You can assume that there is at least one solution.
Output
For each test case, output an integer indicates the maximum number of sequence division.
Sample Input
6
1 2 3 4 5 6
4
1 2 -3 0
5
0 0 0 0 0
Sample Output
6
2
5
Author
ZSTU
Source
2016 Multi-University Training Contest 5