atcoder#ABC296G. [ABC296G] Polygon and Points
[ABC296G] Polygon and Points
Score : points
Problem Statement
There is a convex -gon in the two-dimensional coordinate plane where the positive -axis points to the right and the positive -axis points upward. The vertices of have the coordinates in counter-clockwise order.
For each of points , answer the following question: is that point inside or outside or on the boundary of ?
Constraints
- is a strictly convex -gon. That is, its interior angles are all less than degrees.
- are the vertices of in counter-clockwise order.
- All values in the input are integers.
Input
The input is given from Standard Input in the following format:
Output
Print lines. The -th line should contain IN
if is inside (and not on the boundary), OUT
if it is outside (and not on the boundary), and ON
if it is on the boundary of .
4
0 4
-2 2
-1 0
3 1
3
-1 3
0 2
2 0
ON
IN
OUT
The figure below shows and the given three points. The first point is on the boundary of , the second is inside , and the third is outside .
3
0 0
1 0
0 1
3
0 0
1 0
0 1
ON
ON
ON