AmazonOA #22
Min Days To Deliver Parcels
估计简单可在线判题
考点(AI 标注)哈希计数
Each day, choose a positive integer d and ship exactly d parcels from every center that still has parcels; no non-empty center may be skipped, and d cannot exceed its current stock; empty centers do not take part. Find the minimum number of days to clear all stock, which is 0 when everything is already zero. Based on the fixed original statement, this site corrects an early summary's wrong description that "centers with fewer than d parcels may be skipped"; the original requires every center that still has at least one parcel to take part.
输入格式
The first line contains n; the second line contains n values parcels[i]. Full original range: 1≤n≤1000000, 0≤parcels[i]≤10^9. The standard I/O is this site's addition; the budget per input is 32 MiB, and the million-scale range is not reduced.
输出格式
Output a single integer, the answer.
样例 1
输入:
5
2 3 4 3 3
输出:
3
样例 2
输入:
6
3 3 3 3 3 3
输出:
1
样例 3
输入:
2
0 0
输出:
0
样例说明
Original example 1 ships 2, 1 and 1 parcels in turn, taking 3 days. Original example 2 ships 3 parcels from all six centers each day and finishes in one day. Example 3 is this site's all-zero addition: no operation is needed, so the answer is 0.