In or out


  • محدودیت زمان: ۱ ثانیه
  • محدودیت حافظه: ۲۵۶ مگابایت

The contest area for the programming competition at Semnan University is a convex polygon with nn sides. You will be asked qq questions. In each question, the coordinates of a student are given, and you need to determine whether the student is inside the contest area or not.

input🔗

The first line of input contains a positive integer nn, representing the number of vertices of the polygon that defines the contest area in counter clockwise order.

The i-th line of the next nn lines contain two integers, xix_i and yiy_i, representing the coordinates of i-th vertex of the polygon in order.

The following line contains the integer qq, indicating the number of students.

again In next qq lines, the i-th line contains two integers, xix_i and yiy_i, representing the coordinates of a student.

1n1051 \leq n \leq 10^5 1q1061 \leq q \leq 10^6 xi,yi109|x_i, y_i| \leq 10^9

output🔗

For each student, print "IN" if they are within the contest area, or "OUT" if they are not.

example🔗

sample input 1🔗

4
0 0
10 0
10 10
0 10
2
5 5
15 15
Plain text

sample output 1🔗

IN
OUT
Plain text
ارسال پاسخ برای این سؤال
در حال حاضر شما دسترسی ندارید.