QOJ.ac

QOJ

実行時間制限: 1 s メモリ制限: 64 MB 満点: 100

#12098. 军队训练

統計

Byteland 军队计划在本周末进行其历史上最伟大的军事演习。演习将在北拜特镇的训练场举行。Byteland 军队的军官们非常了解这个训练场,但他们不知道具体的任务分配。这就是他们请求你——新兵——帮助的原因!

你的上级确切地知道训练场上战略点的位置。在演习期间,他们将多次要求占领训练场的不同区域。最关键的决策之一是兵力分配以及确定占领特定区域所需的强度——该强度应与被攻击区域内的战略点数量成正比。你的任务是针对每个由战略点作为顶点构成的多边形区域,确定严格位于该区域内部的战略点数量。

输入格式

标准输入的第一行包含两个整数 $n$ 和 $m$ ($3 \le n \le 1\,000$, $1 \le m \le 100\,000$),分别表示训练场上的战略点数量和查询次数。战略点编号从 $1$ 到 $n$。

接下来的 $n$ 行给出了战略点的描述。第 $i$ 行包含两个整数 $x_{i}$ 和 $y_{i}$ ($-10^{9} \le x_{i}, y_{i} \le 10^{9}$),表示第 $i$ 个战略点的坐标。任意三个战略点均不共线。

接下来的 $m$ 行包含 $m$ 个查询的描述。每个描述以一个整数 $k_{j}$ ($3 \le k_{j} \le n$) 开头,表示多边形的顶点数。随后是 $k_{j}$ 个来自区间 $[1, n]$ 的不同整数,表示作为多边形连续顶点的战略点编号。所有给定的多边形均为简单多边形(即没有自交),且其顶点按顺时针顺序给出。所有 $k_{j}$ 的总和不超过 $1\,000\,000$。

输出格式

你的程序应向标准输出写入 $m$ 行。第 $j$ 行应包含一个整数,表示第 $j$ 个查询中描述的多边形内部的战略点数量。

样例

输入 1

6 4
0 0
0 5
5 0
11 10
5 5
2 1
4 1 2 4 3
4 1 2 5 3
3 6 2 4
3 1 2 6

输出 1

2
1
1
0

图中的圆圈代表战略点,圆圈旁边的数字是它们的编号。该图展示了第一个(实线)和第三个(虚线,黄色填充)查询所对应的区域。

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.