Problem D. Warcry Execution
Xem dạng PDFTrong trường hợp đề bài hiển thị không chính xác, bạn có thể tải đề bài tại đây: Đề bài

At UMT University's annual Code & Conquer tournament, competitors design algorithms for fantasy battles. Your avatar, the warrior Ba Hong, must defeat a horde of n monsters with his enchanted axe Warcry. Each swing works as follows:
• The targeted monster loses exactly ~p~ hit-points.
• Every other monster simultaneously loses exactly ~q~ hit-points ~(q ≤ p)~ from the shock-wave.
If any monster's hit points become non-positive, it is considered slain. Ba Hong can choose the target of each swing and wishes to minimize the total number of axe strikes required to defeat all monsters. Your goal is to compute the minimum number of swings Ba Hong needs to defeat every monster.
Input
The first line contains three integers ~n~, ~p~, and ~q~ ~(1 ≤ n ≤ 2 · 10^5, 1 ≤ q ≤ p ≤ 10^9)~, representing the number of monsters, the damage dealt to the targeted monster, and the damage dealt to all other monsters, respectively.
The second line contains ~n~ integers ~a_1, a_2, ..., a_n~ ~(1 ≤ a_i ≤ 10^9)~, where ai is the initial hit-points of the monsters.
Output
Print a single integer: the minimum number of swings Ba Hong must perform.
Sample Input 1
2 3 2
5 5
Sample Ouput 1
2
Sample Input 2
3 5 3
17 13 14
Sample Ouput 2
5
Bình luận