Problem list
Log in
#coci00179 · COCI 2010/2011 Contest 5

Dvoniz

Platinum III 1.0 s 64 MB

We say that a sequence of $2K$ elements is interesting if neither the sum of the first $K$ elements, nor the sum of the last $K$ elements, is greater than $S$.

A sequence $A$ of length $N$ is given. For every element, output the length of the longest interesting subsequence starting with that element.

Here, a subsequence means a contiguous block of consecutive elements of $A$.

Input

The first line contains integers $N$ and $S$ ($2 \le N \le 100,000$, $1 \le S \le 2 \cdot 10^9$).

The following $N$ lines contain the sequence $A$, one integer per line. The integers are positive and their sum does not exceed $2 \cdot 10^9$.

Output

Output must consist of $N$ lines. The $i$-th line must contain one integer, the length of the longest interesting subsequence starting with the $i$-th element. If an interesting subsequence at that position doesn't exist, output $0$ (zero).

Example 1

Input
5 10000
1
1
1
1
1
Output
4
4
2
2
0

Example 2

Input
5 9
1
1
10
1
9
Output
2
0
0
2
0

Example 3

Input
8 3
1
1
1
1
1
1
1
1
Output
6
6
6
4
4
2
2
0
Source
COCI 2010/2011 Contest 5
Appears in
Not part of a ladder, contest or set yet.
Accepted 0 Submissions 0 Acceptance 0% Solvers 0

Discussion

Threads about this problem. Spoilers are collapsed; wrap hints in ||double bars||.

No discussion yet. Start a thread if something here needs explaining.

Recent submissions Open with filters
Code