Nobita's Love for Shizuka

Nobita's Love for Shizuka

You cannot submit for this problem because the contest is ended. You can click "Open in Problem Set" to view this problem in normal mode.

Time Limit: 1.0 s

Memory Limit: 512.0 MB

Description

Nobita and Shizuka are two famous characters everyone knows. Nobita has fallen in love with Shizuka and wants her to notice him. Today, Shizuka will visit a few of her friends house, forming a non-intersecting cycle starting and ending at her house. Her journey is made up of straight paths connecting a series of stops. Note: The first coordinate is the house of Shizuka.

Nobita wants to stand somewhere inside her path so that she notices him. However, Shizuka will only notice Nobita if he is standing strictly inside the area enclosed by her path.

Your job is to help Nobita. You are given the \(2D\) coordinates of Shizuka’s stops in the order she visits them. You are also given the coordinates of Nobita’s position. Determine if Shizuka will notice Nobita.

Input

  • The first line contains an integer \(n(3 ≤ n ≤ 10^3)\), the total number of coordinates that define Shizuka's stops.
  • The next \(n\) lines each contain two integers \(x\) and \(y\) (\(-10^3 ≤ x_i, y_i ≤ 10^3\)), representing the \(2D\) coordinates of Shizuka's stops in the order she visits them.
  • The last line contains two integers \(x_p\) and \(y_p\) (\(-10^3 ≤ x_p, y_p ≤ 10^3\)), representing the coordinates of Nobita’s position.

Output

Output "YES" if Shizuka notices Nobita; otherwise, output "NO."

Sample

Input Output

3
1 1
-1 1
0 -1
0 0

YES

LU IUJPC : Sylhet Division 2024

Not Attended
Status
Done
Rule
ACM/ICPC
Problem
11
Start at
2024-12-09 04:45
End at
2024-12-09 09:45
Duration
5.0 hour(s)
Host
Partic.
42