QOJ.ac

QOJ

حد الوقت: 6 s حد الذاكرة: 512 MB مجموع النقاط: 100

#2597. 黄蓝巴士

الإحصائيات

给定 $n$ 个蓝色点和 $m$ 个黄色点。你需要找到一个圆,使得所有蓝色点位于该圆的外部或边界上,且所有黄色点位于该圆的内部或边界上。

本题的测试数据生成方式保证了对于每个测试用例,都存在一个满足以下条件的圆: 半径 $r \le 10^9$; 圆心位于点 $(x, y)$,其中 $|x| \le 10^9$ 且 $|y| \le 10^9$; 对于每个蓝色点 $P$,圆心到 $P$ 的距离至少为 $r + 10^{-7} \cdot \max(1, r)$; 对于每个黄色点 $Q$,圆心到 $Q$ 的距离至多为 $r - 10^{-7} \cdot \max(1, r)$。

关于答案的判定标准,请参阅输出格式。

输入格式

第一行包含一个整数 $t$,表示需要解决的测试用例数量 ($1 \le t \le 10^5$)。

每个测试用例的第一行包含一个整数 $n$,表示蓝色点的数量 ($1 \le n \le 50\,000$)。 接下来的 $n$ 行,每行包含两个整数 $x$ 和 $y$,表示一个蓝色点的坐标 ($-10^9 \le x, y \le 10^9$)。 下一行包含一个整数 $m$,表示黄色点的数量 ($1 \le m \le 50\,000$)。 接下来的 $m$ 行,每行包含两个整数 $x$ 和 $y$,表示一个黄色点的坐标 ($-10^9 \le x, y \le 10^9$)。

保证在每个测试用例中,所有点(蓝色和黄色)两两不同。此外,所有测试用例中 $n$ 的总和不超过 $50\,000$,$m$ 的总和不超过 $50\,000$。

输出格式

对于每个测试用例,输出两行。 第一行输出一个实数 $r$,表示圆的半径。 第二行输出两个实数 $x$ 和 $y$,表示圆心的坐标。

如果满足以下条件,你的答案将被视为正确: $0 \le r \le 10^{10}$; $|x| \le 10^{10}$ 且 $|y| \le 10^{10}$; 对于每个蓝色点 $P$,圆心到 $P$ 的距离至少为 $r - 10^{-7} \cdot \max(1, r)$; 对于每个黄色点 $Q$,圆心到 $Q$ 的距离至多为 $r + 10^{-7} \cdot \max(1, r)$。

样例

样例输入 1

3
3
3 1
1 3
4 5
3
3 3
4 3
3 4
2
0 0
-1 -1
2
1 1
2 2
4
2 0
0 2
-2 0
0 -2
4
1 0
0 1
-1 0
0 -1

样例输出 1

1.001
3 3
1.000
1.5 1.5
1.001
0 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.