QOJ.ac

QOJ

Time Limit: 2.0 s Memory Limit: 2048 MB

#22870. vs ヒュドラ

Statistics

$N$ 個の頭を持つヒュドラが現れました。$i$ 番目の頭の最初の体力は $H_i$ です。

あなたは $0$ 回以上の任意の回数だけ攻撃を行うことができます。各攻撃では、以下の $N + 1$ 種類のうちから $1$ つを選びます。

  • 攻撃 $i$($1 \le i \le N$):$i$ 番目の頭の体力を $X$ 減らす。
  • 攻撃 $N + 1$:すべての頭の体力をそれぞれ $Y$ 減らす。

すべての頭の体力を $0$ 以下にするために必要な攻撃回数の最小値を求めてください。

入力

入力は $1$ つ以上のテストケースからなります。入力の $1$ 行目には、テストケースの個数を表す整数 $T$($1 \le T \le 100$)が与えられます。続いて $T$ 個のテストケースが、それぞれ以下の形式で与えられます。

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

各テストケースについて、$1$ 行目には $3$ つの整数 $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$ で与えるダメージを表します。

$2$ 行目には $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$ つ出力してください。

入出力例

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