Time limit
2s
Memory limit
128 MB
The cows build a prison at position (Px, Py) and want to surround it with as many layers of walls as possible. The prison is treated as a single point.
There are N wall posts around the prison. A wall is a closed polygon made by connecting several wall segments, and both endpoints of every segment must be among the given posts.
Every wall must completely enclose the prison. If another wall lies even partly inside a wall, the outer wall must completely enclose that inner wall as well. Two different walls must not cross or touch at a point, and they must not share a wall segment or a post. In other words, there must always be a positive amount of empty space between two different walls.
No three points among the prison position and all wall posts are collinear. Using only the given posts, compute the maximum number of non-overlapping nested wall layers that can be built.
The first line contains the integers N, Px, and Py.
1 <= N <= 1,000
-100,000 <= Px, Py <= 100,000
Each of the next N lines contains the coordinates x and y of one wall post. The absolute value of every coordinate is at most 100,000.
Print one integer: the maximum number of nested wall layers that can be built.