CitadelOA #17
Get Min Operations
Estimated MediumJudge-ready
Topics (AI-labelled)Binary Search
In each round, choose one unfinished task as the primary task and execute it for x seconds, while every other unfinished task executes for y seconds, where y<x. A task leaves as soon as it has executed enough; find the minimum number of rounds to empty the task pool.
Input
The first line contains n x y, followed by n execution amounts. Complete original bounds: 1≤n≤300000, 1≤execution amount≤10^9, 1≤y<x≤10^9; problem 17 keeps its original bound of 300,000 and does not reuse the 100,000 of problem 7.
Output
Output a single integer, the answer.
Example 1
Input:
5 4 2
3 4 1 7 6
Output:
3
Example 2
Input:
5 3 2
3 3 6 3 9
Output:
3
Example 3
Input:
3 3 1
2 3 5
Output:
3
Example notes
The outputs of the three public examples are, in order: 3; 3; 3. These answers were verified by independent enumeration or direct simulation.
Editorial
Loading solution…