cswork / OA打开练习工作台

AmazonOA #229

Compute Least Truck Count

估计中等可在线判题

考点(AI 标注)二分查找位运算贪心调度

Each category has items[i] packages that can be assigned independently. Each truck carries at most C packages, and at most L packages of the same category. All packages must be shipped; find the minimum number of trucks. A category does not have to ride together in a single truck. With no packages at all, 0 trucks are needed.

输入格式

The first line contains n C L; the second line contains the count of each category. The original text had no numeric bounds; this site uses 1≤n≤200000, 0≤count≤10^9, 1≤C,L≤10^9.

输出格式

Output a single integer, the answer.

样例 1

输入:

2 3 2
2 4

输出:

2

样例 2

输入:

3 3 3
4 4 3

输出:

4

样例 3

输入:

1 100 3
10

输出:

4

样例说明

The answers are 2, 4 and 4. The third example is determined by the per-truck limit for a single category.