QOJ.ac

QOJ

Time Limit: 2.0 s Memory Limit: 2048 MB

#22870. 大战九头蛇

Statistics

一只长有 $N$ 个头的九头蛇出现了。第 $i$ 个头最初有 $H_i$ 点生命值。

你可以进行任意次数的攻击(包括零次)。在每次攻击中,从以下 $N + 1$ 种攻击方式中选择一种:

  • 攻击 $i$($1 \le i \le N$):使第 $i$ 个头的生命值减少 $X$。
  • 攻击 $N + 1$:使每个头的生命值都减少 $Y$。

求使每个头的生命值都不超过 $0$ 所需的最少攻击次数。

输入格式

输入包含一个或多个测试用例。输入的第一行包含一个整数 $T$($1 \le T \le 100$),表示测试用例的数量。接下来是 $T$ 个测试用例的描述,每个测试用例的格式如下。

$$ \begin{aligned} &N\ X\ Y \\ &H_1\ H_2\ \ldots\ H_N \end{aligned} $$

对于每个测试用例,第一行包含三个整数 $N$、$X$ 和 $Y$($1 \le N \le 3 \times 10^5$,$1 \le X, Y \le 10^{18}$),分别表示头的数量、攻击 $i$($1 \le i \le N$)造成的伤害,以及攻击 $N + 1$ 造成的伤害。

第二行包含 $N$ 个整数 $H_1, H_2, \ldots, H_N$($1 \le H_i \le 10^{18}$),其中 $H_i$ 表示第 $i$ 个头的初始生命值。

所有测试用例中 $N$ 的总和不超过 $3 \times 10^5$。

输出格式

对于每个测试用例,输出一个整数,表示使每个头的生命值都不超过 $0$ 所需的最少攻击次数。

样例

输入格式 1

2
3 5 2
12 6 17
1 998244353 1000000007
1000000007

输出格式 1

7
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.