#P6679. [COCI 2019/2020 #2] Zvijezda
[COCI 2019/2020 #2] Zvijezda
题目描述
Mirko and Slavko are spending their free time playing with polygons and watching a new season of The Biggest Loser. Mirko recently drew a convex polygon with an even number of vertices . Slavko then considered each pair of oposite sides (two sides are opposite if there are sides between them), drew straight lines that lie on those sides and colored them along with the part of the plane that lies between them and contains the polygon. Finally, Mirko found a set of points and decided to challenge Slavko to answer for each point whether it lies in the colored or uncolored part of the plane. The new episode of The Biggest Loser is about to start and Slavko doesn’t have the time to answer Mirko’s queries. Can you help him?
输入格式
The first line contains an integer which is used as a parameter for generating Mirko's queries. This number can be either or .
The second line contains an even integer from the task description.
Each of the next lines contains two integers () which represent one of the polygon's vertices. You can assume that the vertices are given in the counter - clockwise order and that no three successive vertices are collinear.
The next line contains an integer from the task description.
Each of the next lines contains two integers () which are used as parameters for generating the point in the - th of Mirko's queries.
Let be equal to the number of points in the first (inclusive) of Mirko's queries that lie in the colored part of the plane. Naturally, . The point of Mirko's - th query should then be generated as:
$$P_i=(A_i\oplus(T\cdot X_{i - 1}^3),B_i\oplus(T\cdot X_{i - 1}^3)) $$where represents the bitwise xor operation.
输出格式
The - th line of output should contain the word DA (YES in Croatian) if the point from - th of Mirko's queries lies in the colored part of the plane. Otherwise, the - th line should contain the word NE (NO in Croatian).
0
4
1 1
5 1
4 3
2 2
4
3 2
2 4
6 2
4 5
DA
NE
DA
NE
0
6
-1 -1
2 -1
3 3
2 4
1 4
-2 1
6
2 2
3 0
1 -6
2 6
-5 5
5 10
DA
DA
NE
NE
NE
NE
1
6
-1 -1
2 -1
3 3
2 4
1 4
-2 1
6
2 2
3 0
1 -6
2 6
-5 5
5 10
DA
DA
DA
NE
NE
NE
提示
数据规模及约定
本题采用捆绑测试。
| Subtask | Scores | Constraints |
|---|---|---|
| , | ||
| , | ||
| , |
此外,对于 的数据,$0 \le |x_i|, |y_i| \le 10^9, 0 \le |a_i|, |b_i| \le 2 \times 10^{18}$。
说明
本题分值按 COCI 原题设置,满分 。
题目译自 COCI2019-2020 CONTEST #2 T5 Zvijezda。