Problem G
Maximal Sequences
The problem is simple. You are given a long sequence of
integers
Simple, right?
Input
The first line of input contains a single integer
The third line contains a single integer
Finally, you are guaranteed the sum of all values
Output
For each query, output a single line with the length of the
longest prefix of
Sample Input 1 | Sample Output 1 |
---|---|
7 1 2 3 1 2 1 1 5 1 3 1 2 3 1 2 1 2 2 2 2 3 3 2 1 2 4 2 1 2 |
7 2 2 0 4 |
Sample Input 2 | Sample Output 2 |
---|---|
10 1 2 3 4 5 6 7 8 9 10 5 1 10 1 2 3 4 5 6 7 8 9 10 7 10 1 2 3 4 5 6 7 8 9 10 5 5 1 14 7 6 5 2 6 6 3 4 2 7 5 1 1 1 |
10 4 3 6 1 |