Baltic Olympiad in Informatics: 2007 Day 1, Problem 1
A group of war prisoners are trying to escape from a prison. They have thoroughly planned the escape from the prison itself, and after that they hope to find shelter in a nearby village. However, the village (marked as
You are to write a program which, given the width and the length of the canyon and the coordinates of every soldier in the canyon, and assuming that soldiers do not change their locations, first determines whether prisoners can pass the canyon unnoticed. If this is impossible then the prisoners (having seen enough violence) would like to know the minimum number of soldiers that have to be eliminated in order to pass the canyon safely. A soldier may be eliminated regardless of whether he is visible to any other soldier or not.
Constraints
Input Specification
The first line contains three integers
Note that passing the canyon may start at coordinate
Output Specification
In the first and only line of output, the program should print the minimum number of soldiers that have to be eliminated in order for the prisoners to pass the canyon safely. If the prisoners can escape without any elimination, the program should print
Sample Input
130 340 5
10 50
130 130
70 170
0 180
60 260
Sample Output
1
Grading
Your program will receive partial credits if it can only determine whether the prisoners need to eliminate any guard at all in order to escape. For this, several test runs will be grouped to one test group. You will receive
Comments