Point in polygon
Very easy
Execution time limit is 1 second
Runtime memory usage limit is 128 megabytes
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 ≤ 10^5
) 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.
Examples
Input #1
Answer #1
Input #2
Answer #2
Submissions 1K
Acceptance rate 26%