2023 Winter Waterloo Local Contest, Problem B
BaoBao is playing the famous game Elden Ring these days. It's an open-world game in which you can
control your character to travel from place to place. However, your character could also enter a trap
and you need to figure out how to escape. Right now, BaoBao's character is stuck in a
Starting at point
Note that BaoBao does not need to move in a specific direction to escape. Her escaping route can even be a curve if necessary.
Input Specification
There are multiple test cases. The first line of the input contains an integer
The first line contains an integer
For the following
It is guaranteed that no two generators coincide, and no laser beam or generator will touch
It is also guaranteed that the sum of
Output Specification
For each test case output one line containing one integer indicating the minimum number of generators that need to be removed.
Sample Input
3
2
1 0
2 0
3
1 0
0 1
-1 -1
5
2 -1
1 2
-1 2
-2 -1
0 -2
Sample Output
0
1
2
Explanation for Sample
The second and third sample test cases are shown below. Solid dots and lines represent the remaining laser generators and beams, while hollow dots and dashed lines represent the removed laser generators and beams. The arrow is the escaping route.
Comments