题目链接:点击打开链接
F. Doomsday
time limit per test
memory limit per test
input
output
t units of time. In anticipation of such a significant event n people prepared m vaults in which, as they think, it will be possible to survive. But each vault can accommodate only k
You are given the positions of the people and the vaults on the line. You are to find the maximal number of people who can hide in vaults and think they will survive.
Input
n, m, k and t (1 ≤ n, m, k ≤ 200000, 1 ≤ t ≤ 109) separated by spaces — the number of people, the number of vaults, the capacity of one vault and the time left to the Doomsday.
n
m
9 and 109, inclusively.
Output
Output one integer — the maximal number of people who can hide in vaults and think they will survive.
Examples
input
2 2 1 5 45 55 40 60
output
2
input
2 2 1 5 45 54 40 60
output
1
input
2 2 2 5 45 35 40 60
output
2
input
3 3 1 5 40 45 45 45 50 50
output
3
大意:世界末日在 t 秒后要来了,n 个人,m 个避难所,一个避难所最多容纳 k 个人,每个人一秒只能走 1 米,给出所有人,所有避难所的位置(都位于同一直线上),问最后最多几个人可以活下来。
思路:就是贪心,一直挂在 test11 上,后来改了才过。