CF1575B.Building an Amusement Park
普及/提高-
通过率:0%
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
Mr. Chanek lives in a city represented as a plane. He wants to build an amusement park in the shape of a circle of radius r . The circle must touch the origin (point (0,0) ).
There are n bird habitats that can be a photo spot for the tourists in the park. The i -th bird habitat is at point pi=(xi,yi) .
Find the minimum radius r of a park with at least k bird habitats inside.
A point is considered to be inside the park if and only if the distance between pi and the center of the park is less than or equal to the radius of the park. Note that the center and the radius of the park do not need to be integers.
In this problem, it is guaranteed that the given input always has a solution with r≤2⋅105 .
输入格式
The first line contains two integers n and k ( 1≤n≤105 , 1≤k≤n ) — the number of bird habitats in the city and the number of bird habitats required to be inside the park.
The i -th of the next n lines contains two integers xi and yi ( 0≤∣xi∣,∣yi∣≤105 ) — the position of the i -th bird habitat.
输出格式
Output a single real number r denoting the minimum radius of a park with at least k bird habitats inside. It is guaranteed that the given input always has a solution with r≤2⋅105 .
Your answer is considered correct if its absolute or relative error does not exceed 10−4 .
Formally, let your answer be a , and the jury's answer be b . Your answer is accepted if and only if max(1,∣b∣)∣a−b∣≤10−4 .
输入输出样例
输入#1
8 4 -3 1 -4 4 1 5 2 2 2 -2 -2 -4 -1 -1 -6 0
输出#1
3.1622776589
输入#2
1 1 0 0
输出#2
0.0000000000
说明/提示
In the first example, Mr. Chanek can put the center of the park at (−3,−1) with radius 10≈3.162 . It can be proven this is the minimum r .
The following illustrates the first example. The blue points represent bird habitats and the red circle represents the amusement park.