#P7635. [COCI 2010/2011 #5] DVONIZ
[COCI 2010/2011 #5] DVONIZ
Description
When both the sum of the first elements and the sum of the last elements are not greater than , we call this sequence of elements interesting.
You are given a sequence of length . For each position, output the length of the longest interesting subarray starting at that position.
Input Format
The first line contains integers and .
The next lines each contain an integer from the sequence . These integers are positive, and their total sum does not exceed .
Output Format
Output lines in total. The -th line contains one integer: the length of the longest interesting subarray starting from the -th element.
If there is no interesting subarray starting at the current position, output 0.
5 10000
1
1
1
1
1
4
4
2
2
0
5 9
1
1
10
1
9
2
0
0
2
0
8 3
1
1
1
1
1
1
1
1
6
6
6
4
4
2
2
0
Hint
Constraints
For of the testdata, , .
Notes
The score of this problem follows the original COCI settings, with a full score of .
This problem is translated from COCI2010-2011 CONTEST #5 T5 DVONIZ。
Translated by ChatGPT 5
京公网安备 11011102002149号