AdobeOA #6
Job Execution
Estimated MediumJudge-ready
Topics (AI-labelled)Binary Search
In each round, choose one unfinished task to run for x seconds, while every other unfinished task runs for y seconds, where x>y. A task leaves once it reaches its required time. Find the minimum number of rounds.
Input
The first line contains n x y, and the second line contains n required times. The original only states x>y with no numeric bounds; this site sets 1≤n≤100000, 0≤time≤10^9, 0≤y<x≤10^9. Tasks with time 0 are finished from the start.
Output
Output a single integer answer.
Example 1
Input:
2 3 1
3 4
Output:
2
Example 2
Input:
2 2 1
0 0
Output:
0
Example 3
Input:
2 1 0
4 4
Output:
8
Example notes
The outputs of the three public examples are, in order: 2; 0; 8. Verified by independent enumeration or direct simulation.
Editorial
Loading solution…