P28806 [洛谷] [SHOI2011] Line Fitting
提高+
题目描述

Problem Description

There are $n$ points $v_i(x_i, y_i)$ on a plane. Find the minimum possible value of $D(l) = \max_{1 \le i \le n} dis(v_i, l)$, where $l$ is a line on the plane and $dis(v_i, l)$ represents the distance between point $v_i$ and line $l$.

Input Format

The first line of input contains a positive integer $n$. The next $n$ lines each contain a pair of integers $x_i, y_i$ separated by a space, representing the coordinates of these $n$ points, where $|x_i|, |y_i| \le 10^8$, and no two points coincide.

Output Format

The output should consist of a single line containing a real number, which is the minimum value of $D(l)$, rounded to two decimal places.

Sample Input and Output

Sample Input #1

6
1 0
2 0
3 0
3 2
4 0
5 0

Sample Output #1

1.00

Sample Input #2

6
-2 -1
-1 2
1 2
2 3
3 3
4 4

Sample Output #2

0.86

Notes

Sample Explanation 1

In Sample 1, the line $l$ that achieves the minimum value is $y = 1$.

Sample Explanation 2

In Sample 2, the six points and the line $l$ that achieves the minimum value of $D(l)$ are shown in the figure below.

1

Data Range and Hints

  • Test Point 1: $n = 3$.
  • Test Points 2 to 4: $3 \le n \le 100$.
  • Test Points 5 to 7: $100 < n \le 100000$, and the input file is generated as follows: select a segment, probabilistically choose a point on this segment, and then take the nearest integer point.
  • Test Points 8 to 10: $3 < n \le 100000$.
输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
6 1 0 2 0 3 0 3 2 4 0 5 0
样例输出
1.00