luogu#P7806. 冰魄吐息
冰魄吐息
Background
Problem Description
There are points. The coordinates of point are .
Define a laser beam as the line . If point has distance to this line, it is considered hit by the laser.
Find the minimum cost such that using at most laser beams can destroy all points in the figure.
Input Format
The first line contains two positive integers .
Lines each contain two non-negative integers , representing the coordinates of point .
Output Format
Output the minimum cost on the first line, rounded to 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 , the two blue points have coordinates and . Their distances to the line are both , so the output is 1.20. |
In Sample , the points with coordinates have distance to the line with slope , so the output is 0.97. |
It can be proven that the solutions in both samples are optimal, so the required is minimal.
Notes
- A formula you may need: the distance from point to the line is .
- For C++ users, it is recommended to use the variable type
long doublefor numerical computation.
When outputting, please use a form likeprintf("%.2Lf",ans). Note that theLin%.2Lfis uppercase. - 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 be the maximum value among all .
| Subtask | Score | ||
|---|---|---|---|
For of the data: .
All testdata guarantee that no identical appears more than once.
Afterword
I totally love Ice Soul War Dragon
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

