Our country is under enemy's attack. Hostile bombers are going to fly towards the capital and destroy everything. To defend the capital, we have a number of missiles, ready to launch and hit the enemy's bombers, before they reach the capital. Unfortunately, there are passenger planes in the sky, which we do not want to hit by our missiles.
We have been able to gather useful information regarding enemy's bombers. While they taxi over our missile defense zone, bombers travel in a fixed altitude. All bombers fly with the same speed. The same applies to airplanes, and our missiles. We know the location of each bomber and each airplane at time zero. Our missiles are placed on the ground, and their locations are also known.
You should write a program, that given the information about the bombers, and the locations of passenger planes in the sky, determines the maximum number of bombers that can be successfully hit by our missiles. Then, we pray for the rest of bombers to explode by themselves!
To simplify your task, The following are assumed:
- We consider a flat two-dimensional model of the earth. Thus, the y-coordinate of the airplanes, and attacking bombers, does not change during their movement over our defense zone.
- Each defending missile can be fired, at time zero or afterwards.
- The y-coordinate of bombers, and airplanes are distinct positive integers.
- Each bomber or airplane, has unit length, while our missiles have no length.
- If a missile hits, or just touches the edge of a target in the sky, our missile will explode, while the target keeps moving normally on its path for a while before it explodes. Assume that the hit bomber will explode after passing all defending missiles, i.e. after surpassing the x-coordinate of all our missiles. Note that during this time, it may be hit by other missiles.