QOJ.ac

QOJ

実行時間制限: 1.0 s メモリ制限: 512 MB 満点: 100

#15991. 野兽

統計

烈焰巨兽(Fiery Beast)和冰霜巨兽(Ice Beast)是亚德尼亚(Ardenia)早期的遗迹。它们住在各自的巢穴中,并被长者们画下的强大魔法线限制在巢穴附近。巨兽们不能跨越这些线。然而,近年来,其中一些线消失了。如果巨兽们靠得太近,对整个人类来说将是灾难性的。

作为这片土地的国王,你当然对此感到担忧,并收集了所有关于现存魔法线的信息。这片土地可以被看作是一个无限平面(这一事实是由智者赫尔曼确立的,他朝一个方向旅行了许多天,却仍然能看到新事物!)。冰霜巨兽的巢穴位于点 $(0, 10^{10})$,烈焰巨兽的巢穴位于点 $(0, -10^{10})$。存在若干条无限长的魔法直线,烈焰巨兽和冰霜巨兽都不能跨越其中的任何一条。你想知道始终将两只巨兽隔开的最小距离是多少。

下面给出了一个例子。$I$ 和 $F$ 分别表示巨兽的巢穴,灰色区域表示它们可以自由活动的区域。虚线段对应于这些区域之间的最小距离。

输入格式

输入包含多组测试数据。

输入的第一行包含一个正整数 $Z \le 20$,表示测试数据的组数。接下来是 $Z$ 组测试数据。

每组测试数据的第一行包含一个正整数 $n \le 2 \cdot 10^5$,表示魔法直线的数量。

接下来的 $n$ 行,每行包含三个空格分隔的整数 $a, b, c$,满足 $-10^9 \le a, b, c \le 10^9$ 且 $b \ne 0$。这些数字表示魔法直线 $ax + by + c = 0$。

输出格式

对于每组测试数据,输出单行,包含一个数字,表示两只巨兽之间最小距离的平方。当且仅当你的结果与标准答案的相对或绝对误差不超过 $10^{-5}$ 时,才会被判定为正确。

样例

输入样例 1

2
5
1 -1 0
1 1 0
0 1 -6
0 1 -10
0 1 10
4
1 1 10
2 6 7
-1 2 10
0 1 12

输出样例 1

400.000000
93.250000

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.