QOJ.ac

QOJ

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

#10517. WAPの配置

الإحصائيات

平面上に $n$ 台のデバイスがあり、$i$ 番目のデバイスは点 $(x_i, y_i)$ に位置しています。また、平面上には無限に続く光ファイバーがあり、その直線の方程式は $ax + by + c = 0$ です。

あなたは無線アクセスポイント(WAP)を 1 台持っており、光ファイバー上の任意の場所に WAP を設置して光ファイバーに接続することができます。あなたの目標は、WAP から最も遠いデバイスまでの距離を最小化することです。

入力

入力は複数のテストケースから構成されます。最初の行にテストケースの数 $T$ ($1 \le T \le 10^4$) が与えられます。各テストケースの形式は以下の通りです。

1 行目に整数 $n$ ($1 \le n \le 10^5$) が与えられ、デバイスの数を表します。

続く $n$ 行には、各デバイスの位置を表す 2 つの整数 $x_i$ と $y_i$ ($|x_i|, |y_i| \le 10^4$) が与えられます。

最後の行には、光ファイバーの直線の方程式を表す 3 つの整数 $a, b, c$ ($|a|, |b|, |c| \le 10^4, a$ と $b$ は同時に $0$ になることはない) が与えられます。

各テストファイルにおいて、すべてのテストケースの $n$ の総和は $10^5$ を超えません。

出力

各テストケースについて、WAP から最も遠いデバイスまでの距離の最小値を浮動小数点数で 1 行に出力してください。

あなたの出力と標準解答との絶対誤差または相対誤差が $10^{-6}$ 以下であれば、正解とみなされます。具体的には、あなたの答えを $a$、標準解答を $b$ としたとき、$\frac{|a-b|}{\max(1, |b|)} \le 10^{-6}$ を満たせば正解となります。

入出力例

入力 1

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

出力 1

0.707106781186547524
1.000000114514
2.236067977499789696

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.