Universal Cup Judging System

Universal Cup

Time Limit: 4.0 s Memory Limit: 1024 MB Total points: 100 Difficulty: [show] Hackable ✓
Statistics

在 Byteland 有 $n$ 个无线通信塔,编号为 $1, 2, \dots, n$。第 $i$ 个塔位于 $(x_i, y_i)$。任意两个塔的 $x$ 坐标互不相同,且任意两个塔的 $y$ 坐标互不相同。每个塔的传输半径均为 $R$。换句话说,第 $i$ 个塔可以在一次跳跃内向第 $j$ 个塔发送消息,当且仅当 $\sqrt{(x_i - x_j)^2 + (y_i - y_j)^2} \le R$。初始时,所有塔均处于使用状态。

当且仅当第 $a$ 个塔 ($1 \le a \le n$) 满足以下所有条件时,称其为冗余塔: 第 $a$ 个塔处于使用状态。 对于每一对处于使用状态的塔 $b$ 和 $c$ ($1 \le b < c \le n, b \neq a, c \neq a$),如果它们之间可以通过处于使用状态的塔直接或间接通信,那么它们之间也可以在不经过第 $a$ 个塔的情况下直接或间接通信。注意,消息只能由处于使用状态的塔进行传输。

你需要执行 $q$ 次操作。在每次操作中,给定一个整数 $k$ ($1 \le k \le n$),表示状态发生改变的塔的编号。如果第 $k$ 个塔处于使用状态,它将变为不使用状态;如果它处于不使用状态,它将变为使用状态。每次操作后,你需要统计当前冗余塔的数量。

输入格式

第一行包含两个整数 $n$ 和 $R$ ($1 \le n \le 10^5, 2 \le R \le 5$),分别表示塔的数量和传输半径。

接下来的 $n$ 行中,第 $i$ 行包含两个整数 $x_i$ 和 $y_i$ ($1 \le x_i, y_i \le n$),表示第 $i$ 个塔的位置。保证任意两个塔的 $x$ 坐标互不相同,且任意两个塔的 $y$ 坐标互不相同。

下一行包含一个整数 $q$ ($1 \le q \le 10^5$),表示操作次数。

接下来的 $q$ 行,每行包含一个整数 $k$ ($1 \le k \le n$),表示一次操作。令 $last$ 为你上一次回答的冗余塔数量。注意,在输入开始时 $last$ 应重置为 $0$。对于每次操作,$k$ 是加密的:其真实值为 $k \oplus last$。在上述表达式中,符号 “$\oplus$” 表示按位异或运算。同时请注意,题目描述中给出的约束仅适用于解密后的对应参数,加密后的值不受这些约束限制。

输出格式

对于每次操作,输出一行,包含一个整数,表示当前冗余塔的数量。

样例

输入 1

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

输出 1

4
3
2
2
2
3

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.