QOJ.ac

QOJ

Time Limit: 2.0 s Memory Limit: 2048 MB

#22870. vs Hydra

Statistics

En hydra med $N$ huvuden har dykt upp. Det $i$-te huvudet har från början $H_i$ hälsopoäng.

Du får utföra attacker valfritt antal gånger, inklusive noll gånger. I varje attack väljer du en av följande $N + 1$ typer:

  • Attack $i$ ($1 \le i \le N$): Minska hälsopoängen för det $i$-te huvudet med $X$.
  • Attack $N + 1$: Minska hälsopoängen för varje huvud med $Y$.

Hitta det minsta antalet attacker som krävs för att få varje huvuds hälsopoäng att bli högst $0$.

Indata

Indata innehåller ett eller flera testfall. Den första raden i indata innehåller ett heltal $T$ ($1 \le T \le 100$), vilket är antalet testfall. Därefter följer beskrivningarna av de $T$ testfallen, vart och ett i följande format.

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

För varje testfall innehåller den första raden tre heltal $N$, $X$ och $Y$ ($1 \le N \le 3 \times 10^5$, $1 \le X, Y \le 10^{18}$), som representerar antalet huvuden, skadan som Attack $i$ ($1 \le i \le N$) gör respektive skadan som Attack $N + 1$ gör.

Den andra raden innehåller $N$ heltal $H_1, H_2, \ldots, H_N$ ($1 \le H_i \le 10^{18}$), där $H_i$ representerar det ursprungliga antalet hälsopoäng för det $i$-te huvudet.

Summan av $N$ över alla testfall överstiger inte $3 \times 10^5$.

Utdata

För varje testfall, skriv ut ett enda heltal som representerar det minsta antalet attacker som krävs för att få varje huvuds hälsopoäng att bli högst $0$.

Exempel

Indata 1

2
3 5 2
12 6 17
1 998244353 1000000007
1000000007

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