QOJ.ac

QOJ

Limite de temps : 1 s Limite de mémoire : 512 MB Points totaux : 100

#836. 怪物农场

Statistiques

有 $n$ 只怪物,第 $i$ 只怪物初始有 $h_i$ 点生命值。 如果一只怪物的生命值严格大于零,则称其为存活状态。 你的攻击力为 $a$,对手的攻击力为 $b$。 只要还有怪物存活,你和对手就会轮流攻击怪物(你先手)。 你非常聪明,因此在你的回合,你可以选择攻击任意一只存活的怪物,或者什么都不做。如果你选择攻击第 $i$ 只怪物,该怪物的生命值 $h_i$ 将减少恰好 $a$。 在你的攻击之后,如果该怪物死亡(不再存活),你将获得一个胜利点。 另一方面,你的对手并不聪明。在他的回合,他会找到存活怪物中索引最小的一只并进行攻击(即找到最小的 $i$ 使得 $h_i > 0$,并将 $h_i$ 减少恰好 $b$)。 请问你最多能获得多少个胜利点?

输入格式

第一行包含三个整数 $n, a, b$ ($1 \le n \le 300\,000, 1 \le a, b \le 10^9$):怪物的数量,以及你和对手的攻击力。 第二行包含 $n$ 个整数 $h_1, h_2, \dots, h_n$ ($1 \le h_i \le 10^9$):怪物的生命值。

输出格式

输出一个整数:你能获得的最大胜利点数。

样例

样例输入 1

3 1 1
1 1 1

样例输出 1

2

样例输入 2

3 1 1
2 2 2

样例输出 2

3

样例输入 3

10 34 100
17 27 73 17 60 12 25 53 31 46

样例输出 3

5

说明

在第一个样例中,在你的第一个回合,你可以杀死第三只怪物;在你的第二个回合,你可以杀死第二只怪物。 在第二个样例中,你可以等待直到最左侧的怪物生命值变为 $h_i = 1$,然后亲自将其击杀。

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.