#C8283. Minimum Delivery Trips
Minimum Delivery Trips
Minimum Delivery Trips
In this problem, you are given two integers (n) and (m) representing the number of in-house drivers and the total number of parcels respectively. The second line of input contains (n) integers where each integer (c_i) represents the capacity of a driver, and the third line contains (m) integers where each integer (d_j) represents the demand (weight) of a parcel. A driver can deliver a parcel if his capacity is at least the parcel's demand (i.e. (c_i \ge d_j)). However, each in-house driver can be used at most once. If a parcel cannot be delivered by any available driver, it must be delivered externally (which still counts as one trip). The task is to compute the minimum number of trips required to deliver all parcels using an optimal assignment strategy.
inputFormat
The input is read from standard input (stdin) and consists of three lines:
- The first line contains two space-separated integers (n) and (m), where (n) is the number of in-house drivers and (m) is the number of parcels.
- The second line contains (n) space-separated integers representing the drivers' capacities.
- The third line contains (m) space-separated integers representing the parcels' demands.
outputFormat
Output a single integer to standard output (stdout) — the minimum number of trips required to deliver all parcels.## sample
3 4
3 4 5
2 2 4 5
4