Problems
Point in polygon
Point in polygon
As is known, a simple polygon is a figure consisting of disjoint segments ("sides") connected in pairs with the formation of a closed path. Given a simple polygon and a point, determine whether this point lies inside or on the boundary of this polygon or outside it.
Input
The first line contains three integers: n (3 ≤ n ≤ 105
) and point coordinates. Next n lines contains pair of numbers - the coordinates of the next vertex of a simple polygon in the order of traversing by or counter-clockwise.
Output
Print the string "YES" if the given point is inside the given polygon or on its border, and "NO" otherwise.
Input example #1
3 0 0 1 0 0 1 1 1
Output example #1
NO
Input example #2
4 3 2 0 0 1 5 5 5 6 0
Output example #2
YES