QOJ.ac

QOJ

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

#10517. Setting up WAP

الإحصائيات

There are $n$ devices on a plane, where the $i$-th device is located at $(x_i, y_i)$. Additionally, there is an infinitely long fiber optic cable on the plane, represented by the line equation $ax + by + c = 0$.

You have a Wireless Access Point (WAP), which you can deploy at any position on the fiber optic cable to connect it to the cable. Your goal is to minimize the distance from the WAP to the farthest device.

Input

Each test file contains multiple test cases. The first line contains the number of test cases $T$ ($1 \le T \le 10^4$). The format for each test case is as follows:

The first line contains an integer $n$ ($1 \le n \le 10^5$), representing the number of devices.

The next $n$ lines each contain two integers $x_i$ and $y_i$ ($|x_i|, |y_i| \le 10^4$), representing the position of each device.

The last line contains three integers $a$, $b$, and $c$ ($|a|, |b|, |c| \le 10^4$, $a$ and $b$ are not both $0$), describing the equation of the line where the fiber optic cable is located.

Within each test file, it is guaranteed that the sum of $n$ over all test cases does not exceed $10^5$.

Output

For each test case, output a single floating-point number representing the minimum possible distance from the WAP to the farthest device.

Your output will be considered correct if the absolute or relative error between your answer and the standard answer does not exceed $10^{-6}$. Specifically, if your answer is $a$ and the standard answer is $b$, your answer is considered correct if and only if $\frac{|a-b|}{\max(1, |b|)} \le 10^{-6}$.

Examples

Input 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

Output 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.