#C2315. Drone Delivery Optimization
Drone Delivery Optimization
Drone Delivery Optimization
A popular delivery company uses drones to deliver packages. Each package has an associated distance from the warehouse. Each drone is characterized by its battery life and speed. A drone can deliver a package if its battery life multiplied by its speed is at least twice the distance to the package; mathematically, it must satisfy the inequality: \(battery \times speed \ge 2 \times distance\). Given the list of package distances and the available drones, determine the maximum number of packages that can be delivered.
inputFormat
The first line contains an integer T representing the number of test cases. For each test case, the first line contains two integers N and M which denote the number of packages and the number of drones respectively. The next N lines each contain one integer representing the package distance. The following M lines each contain two integers representing the battery life and speed of a drone.
outputFormat
For each test case, output a single integer on a new line representing the maximum number of packages that can be delivered.## sample
2
3 2
15
20
30
50 1
40 2
4 3
10
25
35
50
30 1
60 2
50 1
2
3
</p>