MicrosoftOA #36
Maximize Number of Produced Cars
Estimated HardJudge-ready
Each car can be assigned to either assembly line, cannot switch lines once started, and is built at most once. The two lines have time budgets X and Y respectively; maximize the number of cars built.
Input
The first line contains N X Y (1≤N≤1000, 1≤X,Y≤500), and the second line contains N durations (1..1000).
Output
Output a single integer, the answer.
Example 1
Input:
3 1 1
1 1 3
Output:
2
Example 2
Input:
5 8 9
6 5 5 4 3
Output:
4
Example 3
Input:
4 8 8
5 5 4 6
Output:
2
Example notes
Example 1: each line builds one car of duration 1, for 2 in total.
Example 2: split the cars as 3+5 and 4+5, for 4 cars in total.
Example 3: any two cars take at least 9, so each line builds at most one car, for 2 in total.
Editorial
Loading solution…