Point in polygon#8357

Point in polygon

1 δευτερόλεπτο
128 megabyte
Πολύ εύκολο

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.

Είσοδος

The first line contains three numbers: (3 \leq n \leq 10^5) and point coordinates. Next lines contain pairs of numbers - the coordinates of the next vertex of a simple polygon in clockwise or counter-clockwise order.

Έξοδος

Print the string "YES" if the given point is inside the given polygon or on its border, and "NO" otherwise.

Παραδείγματα

Παράδειγμα 1

Loading
Loading

Παράδειγμα 2

Loading
Loading