当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

4420:Alice and Bob

题目描述
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?
输入解释
There are multiple test cases, for each case:
The first line is an integer N. (1 <= N <= 100,000)
The second line contains two integers L, R. (0 <= L <= R <= 263 - 1)
The third line contains two integers aCount, bCount.
The fourth line contains N integers p[0], p[1], ..., p[N - 1], denoting the positions of the white balls.
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.
输出解释
For each test case, output one line representing the maximum number.
输入样例
2
5 9
3 1
5 8
3
6 10
5 0
6 8 10
输出样例
1
3
来自杭电HDUOJ的附加信息
Recommend zhuyuanchen520

该题目是Virtual Judge题目,来自 杭电HDUOJ

源链接: HDU-4420

最后修改于 2020-10-25T23:13:20+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
4000/2000MS(Java/Others) 32768/32768K(Java/Others)