SnowflakeOA #15
Job Execution
Estimated MediumJudge-ready
Topics (AI-labelled)Binary Search
In one operation, choose an unfinished task and run it for x seconds while every other task runs for y seconds, where y<x; a task exits once its accumulated run time reaches its required time. Find the minimum number of operations needed to finish all tasks. The original snapshot restores y<x.
Input
The first line contains n x y, and the second line contains n execution times; 1≤n≤100000, 1≤time≤10⁹, 1≤y<x≤10⁹.
Output
Output the single integer required by the problem.
Example 1
Input:
5 4 2
3 4 1 7 6
Output:
3
Example 2
Input:
1 2 1
1
Output:
1
Example 3
Input:
2 3 1
10 10
Output:
6
Example notes
The answers to the three public examples are, in order: 3; 1; 6. All examples have been verified by independent small-scale enumeration or state search.
Editorial
Loading solution…