luogu#P7806. 冰魄吐息

冰魄吐息

Background

Enhanced Version\text{Enhanced Version}\Leftarrow

Problem Description

There are NN points. The coordinates of point ii are (xi,yi)(x_i,y_i).

Define a laser beam as the line y=kxy=kx. If point ii has distance d\le d to this line, it is considered hit by the laser.

Find the minimum cost dd such that using at most KK laser beams can destroy all points in the figure.

Input Format

The first line contains two positive integers N,KN,K.

Lines 2N+12 \sim N+1 each contain two non-negative integers xi,yix_i,y_i, representing the coordinates of point ii.

Output Format

Output the minimum cost dd on the first line, rounded to 22 digits after the decimal point.

2 1
2 3
6 3
1.20
4 3
1 6
4 6
4 2
4 0
0.97

Hint

Sample Explanation

In Sample #1\#1, the two blue points have coordinates (2,3)(2,3) and (6,3)(6,3). Their distances to the line y=34xy=\frac{3}{4}x are both 65=1.2\frac{6}{5}=1.2, so the output is 1.20. In Sample #2\#2, the points with coordinates (4,0),(4,2)(4,0),(4,2) have distance 417170.97014\frac{4}{17}\sqrt{17}\approx0.97014\dots to the line with slope 14\frac{1}{4}, so the output is 0.97.

It can be proven that the solutions in both samples are optimal, so the required dd is minimal.

Notes

  1. A formula you may need: the distance from point (x0,y0)(x_0,y_0) to the line y=kxy=kx is y0kx0k2+1\dfrac{|y_0-kx_0|}{\sqrt{k^2+1}}.
  2. For C++ users, it is recommended to use the variable type long double for numerical computation.
    When outputting, please use a form like printf("%.2Lf",ans). Note that the L in %.2Lf is uppercase.
  3. This problem may involve many floating-point operations. Although the time limit has been increased, please still pay attention to constant factors that affect performance.

Constraints

This problem uses bundled testdata.

Let MM be the maximum value among all xi,yix_i,y_i.

Subtask Score MM\le KK\le
11 3030 1010 11
22 1.5×1041.5\times10^4
33 4040

For 100%100\% of the data: 1N,M,K2.5×1041\le N,M,K\le2.5\times10^4.

All testdata guarantee that no identical (xi,yi)(x_i,y_i) appears more than once.


Afterword

I totally love Ice Soul War Dragon \sim

If you also love ddt, please find the problem setter after the contest ends and beat him up.

The setter recommends reading the solution editorial (advantage: obvious): https://www.luogu.com.cn/blog/_post/362493

Translated by ChatGPT 5