logo AlgoBeat OnlineJudge
登录 注册

#205683. [COCI 2019/2020 #2] Zvijezda

内存限制:128 MiB 时间限制:1000 ms 标准输入输出
题目类型:VJudge(洛谷) 评测方式:VJudge
上传者: 匿名

题目描述

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:

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).

样例

样例输入 1

0
4
1 1
5 1
4 3
2 2
4
3 2
2 4
6 2
4 5

样例输出 1

DA
NE
DA
NE

样例输入 2

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

样例输出 2

DA
DA
NE
NE
NE
NE

样例输入 3

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

样例输出 3

DA
DA
DA
NE
NE
NE

数据范围与提示

数据规模及约定

本题采用捆绑测试。

Subtask Scores Constraints
,
,
,

此外,对于 的数据,。

说明

本题分值按 COCI 原题设置,满分 。

题目译自 COCI2019-2020 CONTEST #2 T5 Zvijezda。