QOJ.ac

QOJ

時間限制: 2.0 s 記憶體限制: 512 MB 總分: 100 可 Hack ✓

#9364. 隐藏池

统计

我们将时间的一个时刻选为时间起点,简称为“起点”。 知名游戏《垃圾箱 7》(Rubbish Bin 7)在从起点开始的 $10^{100}$ 秒时间间隔内(该时间间隔称为“区间”)的匹配模型如下: 每场比赛恰好包含 $p$ 名玩家。假设在“区间”内搜索比赛的玩家总数能被 $p$ 整除。将玩家按开始搜索比赛的时间排序,平局时任意处理。第 $i$ 场比赛包含按此顺序排列的第 $(i-1)p+1$ 到第 $ip$ 名玩家。

阿尔萨斯(Arthas)准备直播玩《垃圾箱 7》,他将在起点 $kT$ 秒后开始搜索比赛,其中 $T$ 是给定的固定整数,$k$ 是阿尔萨斯可以自由选择的非负整数。 此外还有 $n$ 名普通玩家。第 $i$ 名玩家将在起点 $t_i$ 秒后开始搜索比赛。$t_i$ 不能被 $T$ 整除。 还有 $m$ 名“狙击手”(streamsnipers),他们的目标是进入与阿尔萨斯相同的比赛(并制造一些高质量内容,让阿尔萨斯在整场游戏中感到沮丧并抱怨)。他们必须在“区间”内搜索一次比赛,且必须在起点 $l+0.5$ 秒后开始搜索($l$ 是狙击手可以自行选择的整数,不同的狙击手可以在同一时刻开始搜索)。 狙击手知道普通玩家何时开始搜索(即 $t_i$ 的值)。阿尔萨斯的直播有 $d$ 秒的延迟,因此在他开始搜索比赛 $d$ 秒后,狙击手就会知道。阿尔萨斯将在“区间”内开始搜索比赛(你可以假设他不会受到 DDoS 攻击)。

注意,在上述限制条件下,对于同时开始搜索的玩家,平局如何处理并不重要(因为普通玩家是不可区分的,狙击手也是如此)。 请帮助狙击手设计一种策略,使得在阿尔萨斯可能开始搜索比赛的所有时间点中,与阿尔萨斯同场比赛的狙击手数量的最小值最大化。求出该狙击手数量。

输入格式

第一行包含 5 个整数 $n, m, T, d, p$ ($1 \le n \le 5 \cdot 10^5$, $1 \le m, T, d, p \le 10^{12}$, $n+m+1$ 能被 $p$ 整除) —— 分别为普通玩家数量、狙击手数量、阿尔萨斯搜索时间的倍数、直播延迟以及单场比赛的玩家人数。 第二行包含 $n$ 个整数 $t_i$ ($1 \le t_i \le 10^{18}$, $t_i$ 不能被 $T$ 整除)。第 $i$ 个数表示第 $i$ 名普通玩家开始搜索的时间。

输出格式

输出一个整数 —— 你所求出的狙击手数量。

样例

样例输入 1

8 3 6 3 3
13 5 21 23 25 22 7 11

样例输出 1

1

样例输入 2

6 5 7 7 4
1 2 3 4 5 6

样例输出 2

2

说明

在第一个样例中,一种可能的策略如下:一名狙击手在 5.5 秒时开始搜索,另一名在 11.5 秒时开始搜索,最后一名在阿尔萨斯开始搜索 3.5 秒后开始搜索(他会知道是因为延迟为 3,小于 3.5)。

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.