Courtney has a convex polygon with n vertices. She define the point with coordinates x and y as \((x, y)\). Courtney wants to do three types of queries:
- 1 x y - rotate polygon on 90 degrees in counterclockwise order around point \((x, y)\)
- 2 x y - reflect polygon through point \((x, y)\)
- 3 x y - check if point \((x, y)\) is inside polygon
But it's too difficult for Courtney. Help her!
\(INPUT\)
The first line of input contains two integers n and q \((3 \leq n \leq 100 000, 1 \leq q \leq 300 000)\) - number of vertices in polygon and number of queries.
Then n lines follow. The i-th of these lines contains two integers \(x_i\) and \(y_i\) \((-100 000 000 \leq x_i, y_i \leq 100000000)\) - the i-th point of polygon. Points are given in counterclockwise order. There no such three points that would lie on the same polygon side. The area of polygon is greater than 0.
Then q lines follow. The i-th of these lines contains three integers \(type_i\), \(x_i\), \(y_i\) \((1 \leq type_i \leq 3, -100000000 <= x_i, y_i <= 100000000)\) - parameters of i-th query.
\(OUTPUT\)
For each query of the third type print "Yes" (without quoters) if point \((x_i, y_i)\) lies in polygon and "No" (without quoters) otherwise.
\(NOTES\)
In this problem point lies inside polygon if it lies strictly inside polygon or lies on polygon border.
- \(ABC\) - is polygon before changes
- \(EFG\) - is \(ABC\) after reflect it through D
- \(IKJ\) - is \(EFG\) after rotate it on 90 degrees in counterclockwise order around H
Please login to use the editor
You need to be logged in to access the code editor
Loading...
Please wait while we load the editor
Login to unlock the editorial
Please login to use the editor
You need to be logged in to access the code editor
Loading...
Please wait while we load the editor