#C433. Drone Delivery Allocation
Drone Delivery Allocation
Drone Delivery Allocation
Given a set of drones with specific weight limits and a set of deliveries with respective weights, determine whether it is possible to assign each delivery to a unique drone such that the weight of the delivery does not exceed the drone’s limit.
Mathematically, given arrays \( L = [L_1, L_2, \dots, L_n] \) and \( D = [d_1, d_2, \dots, d_m] \), determine if there exists an injection \( f: \{1, \dots, m\} \to \{1, \dots, n\} \) such that \( d_i \le L_{f(i)} \) for all \( i \in \{1,2,\dots,m\} \).
inputFormat
The first line contains two integers \( n \) and \( m \) separated by a space, corresponding to the number of drones and the number of deliveries, respectively.
The second line contains \( n \) space-separated integers representing the weight limits of the drones.
The third line contains \( m \) space-separated integers representing the weights of the deliveries.
outputFormat
Output True
if it is possible to allocate each delivery to a drone without exceeding its weight limit, otherwise output False
.
3 3
5 5 5
2 3 4
True