#P4636. [SHOI2011] 直线拟合

[SHOI2011] 直线拟合

Description

There are nn points vi(xi,yi)v_i(x_i, y_i) on the plane. Find the minimum possible value of D(l)=max1indis(vi,l)D(l)=\max_{1\le i\le n} dis(v_i, l), where the variable ll is a line on the plane, and dis(vi,l)dis(v_i, l) denotes the distance between the line ll and the point viv_i.

Input Format

The first line contains a positive integer nn. The next nn lines each contain a pair of integers xi,yix_i, y_i, separated by a space, representing the coordinates of the nn points in order. Here xi,yi108|x_i|, |y_i| \le 10^8, and no two points coincide.

Output Format

Output a single line containing a real number, the minimum value of D(l)D(l), rounded to two decimal places.

6
1 0
2 0
3 0
3 2
4 0
5 0
1.00
6
-2 -1
-1 2
1 2
2 3
3 3
4 4
0.86

Hint

Sample Explanation 1

In sample 11, when the minimum is achieved, the line ll is y=1y=1.

Sample Explanation 2

In sample 22, the 66 points and the line ll when D(l)D(l) reaches its minimum are shown in the figure.

1

Constraints and Notes

Test case 11: n=3n=3.

Test cases 242 \sim 4: 3n1003 \le n \le 100.

Test cases 575 \sim 7: 100<n100000100 < n \le 100000, and the input file is generated as follows: choose a line segment; each time, first pick a point uniformly at random on the segment, then take the lattice point closest to that point.

Test cases 8108 \sim 10: 3<n1000003 < n \le 100000.

Translated by ChatGPT 5