cswork / OA打开练习工作台

MicrosoftOA #36

Maximize Number of Produced Cars

估计困难可在线判题

考点(AI 标注)背包计数贪心调度

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.

输入格式

The first line contains N X Y (1≤N≤1000, 1≤X,Y≤500), and the second line contains N durations (1..1000).

输出格式

Output a single integer, the answer.

样例 1

输入:

3 1 1
1 1 3

输出:

2

样例 2

输入:

5 8 9
6 5 5 4 3

输出:

4

样例 3

输入:

4 8 8
5 5 4 6

输出:

2

样例说明

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.