
ZOJ Problem Set  3655
These days, Alice came up with a new game. In this game, there are some balls placed in a line which are numbered from L to R from left to right. It is known that N of the balls are white, while others are black. Alice will select aCount consecutive balls, after that, Bob will remove bCount balls from the balls that Alice has selected. Bob could remove those bCount balls one by one, for each ball he removes, he can choose whether to select the left most one or right most one. The goal of Alice is to maximize the number of white balls after Bob's operation, and Bob's goal is to minimize this number. So, what is the maximum number of white balls after Bob's operation? Input
There are multiple test cases, for each case: It is guaranteed that p[i  1] < p[i] (1 ≤ i ≤ N  1), L ≤ p[0], p[N  1] ≤ R, 0 ≤ aCount ≤ R  L + 1, 0≤bCount ≤ aCount. OutputFor each test case, output one line representing the maximum number. Sample Input2 5 9 3 1 5 8 3 6 10 5 0 6 8 10 Sample Output1 3 Contest: The 2012 ACMICPC Asia Changchun Regional Contest 