문제
Problem 1: Tied Down [Brian Dean, 2012]
s we all know, Bessie the cow likes nothing more than causing mischief on the farm. To keep her from causing too much trouble, Farmer John decides to tie Bessie down to a fence with a long rope. When viewed from above, the fence consists of N posts

To help Bessie escape, the rest of the cows have stolen a saw from the barn. Please determine the minimum number of fence posts they must cut through and remove in order for Bessie to be able to pull free (meaning she can run away to the right without the rope catching on any of the fence posts).
All
입력
Line 1: Four space-separated integers: N, M, bx, by.
Lines
Lines
출력
Line 1: The minimum number of posts that need to be removed in order for Bessie to escape by running to the right.
예제1
2 10 6 1
2 3
2 1
6 1
2 4
1 1
2 0
3 1
1 3
5 4
3 0
0 1
3 2
6 1
1
Input Details
There are two posts at (2,3) and (2,1). Bessie is at (6,1). The rope goes from (6,1) to (2,4) to (1,1), and so on, ending finally at (6,1). The shape of the rope is the same as in the figure above.
Output Details
Removing either post 1 or post 2 will allow Bessie to escape.