CloudflareOA #1
Determine Minimum Partitions Required
估计简单可在线判题
Each partition has a capacity and a used amount, and data may be split into chunks and moved to other partitions. Find the minimum number of partitions that must be kept to hold all existing data; data in an original partition does not have to be moved as a whole.
输入格式
The first line contains n, the second line contains n capacities, and the third line contains n used amounts. The original had no numeric bounds; this site adds 1≤n≤200000, capacities 1..10^9, and 0≤used[i]≤capacity[i]. When the total usage is 0, this site explicitly outputs 0.
输出格式
Output a single integer, the answer.
样例 1
输入:
4
10 15 15 20
5 10 15 5
输出:
2
样例 2
输入:
2
2 9
0 0
输出:
0
样例 3
输入:
2
2 9
2 2
输出:
1
样例说明
The outputs of the three public examples are, in order: 2; 0; 1. Verified by independent enumeration or direct simulation.