QOJ.ac

QOJ

Limite de temps : 3.0 s Limite de mémoire : 512 MB Points totaux : 100

#11707. 中心湖

Statistiques

Jaehyun 居住的城镇是一个半径为 $R$ 的圆。圆周上有 $360\,000$ 个点,按逆时针方向编号:如果你从点 $359\,999$ 沿逆时针方向走,下一个点就是点 $0$。相邻点之间的距离均相等。

最初,在 $360\,000$ 个点中的某些位置有 $N$ 座房屋。由于整个区域最初是平坦的,人们总是可以通过直线路径到达彼此的家中。然而,城市市长 Sunghyeon 下令在城镇中心挖掘一个湖泊以美化环境。湖泊的中心与城镇的中心重合。他还计划拆除旧房屋并建造新房屋。

Jaehyun 担心由于中心湖泊的存在,往返于房屋之间会花费很长时间。你的任务是计算两座房屋之间最短距离的最大值。当然,每当市长下令建造或拆除房屋时,你都需要重新计算答案。

输入格式

第一行包含两个空格分隔的整数 $R$ 和 $r$:城镇的半径和湖泊的半径($10 \le R \le 10^5$,$1 \le r < R$)。

第二行包含一个整数 $N$($2 \le N \le 100\,000$)。第三行包含 $N$ 个空格分隔的整数 $a_1, a_2, \dots, a_N$:$N$ 座房屋的位置($0 \le a_i < 360\,000$,所有 $a_i$ 互不相同)。

下一行包含一个整数 $Q$,即查询次数($1 \le Q \le 100\,000$)。

接下来的 $Q$ 行描述了查询。每行包含两个空格分隔的整数 $q$ 和 $x$($1 \le q \le 2$,$0 \le x < 360\,000$)。

每个查询根据其类型具有以下格式之一:

  • “$1\ x$”:在点 $x$ 处建造新房屋。
  • “$2\ x$”:拆除点 $x$ 处的房屋。

保证当 $q=1$ 时点 $x$ 处没有房屋,当 $q=2$ 时点 $x$ 处有房屋。此外,保证任何时候至少有两座房屋。

输出格式

输出 $Q+1$ 行。第一行输出湖泊出现后、所有查询执行前两座房屋之间的最大距离。接下来的 $Q$ 行,输出执行每次查询后的所需答案。绝对误差或相对误差在 $10^{-6}$ 以内均可接受。

样例

输入 1

10 5
2
0 90000
4
1 180000
1 240000
2 0
2 90000

输出 1

14.14213562
22.55649583
22.55649583
19.93850195
10

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.