CF1575B.Building an Amusement Park

提高+/省选-

通过率:0%

时间限制:5.00s

内存限制:512MB

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 rr. The circle must touch the origin (point (0,0)(0, 0)).

There are nn bird habitats that can be a photo spot for the tourists in the park. The ii-th bird habitat is at point pi=(xi,yi)p_i = (x_i, y_i).

Find the minimum radius rr of a park with at least kk bird habitats inside.

A point is considered to be inside the park if and only if the distance between pip_i 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⋅105r \leq 2 \cdot 10^5.

陈先生生活在一个以平面表示的城市中。他希望建造一个半径为 rr 的圆形游乐园。该圆必须与原点(即点 (0,0)(0, 0))相切。

共有 nn 个鸟类栖息地,可作为游乐园内游客的拍照景点。第 ii 个鸟类栖息地位于点 pi=(xi,yi)p_i = (x_i, y_i)。

请找出满足至少包含 kk 个鸟类栖息地的游乐园的最小半径 rr。

当且仅当点 pip_i 到游乐园中心的距离小于或等于游乐园半径时,该点才被视为在游乐园内部。注意:游乐园的中心坐标和半径不一定是整数。

本题保证输入数据总存在一个解,且满足 r≤2⋅105r \leq 2 \cdot 10^5。

输入格式

The first line contains two integers nn and kk (1≤n≤1051 \leq n \leq 10^5, 1≤k≤n1 \leq k \leq n) — the number of bird habitats in the city and the number of bird habitats required to be inside the park.

The ii-th of the next nn lines contains two integers xix_i and yiy_i (0≤∣xi∣,∣yi∣≤1050 \leq |x_i|, |y_i| \leq 10^5) — the position of the ii-th bird habitat.

第一行包含两个整数 nn 和 kk(1≤n≤1051 \leq n \leq 10^5,1≤k≤n1 \leq k \leq n)—— 分别表示城市中鸟类栖息地的数量以及公园内必须包含的鸟类栖息地数量。

接下来的 nn 行中,第 ii 行包含两个整数 xix_i 和 yiy_i(0≤∣xi∣,∣yi∣≤1050 \leq |x_i|, |y_i| \leq 10^5)—— 表示第 ii 个鸟类栖息地的位置。

输出格式

Output a single real number rr denoting the minimum radius of a park with at least kk bird habitats inside. It is guaranteed that the given input always has a solution with r≤2⋅105r \leq 2 \cdot 10^5.

Your answer is considered correct if its absolute or relative error does not exceed 10−410^{-4}.

Formally, let your answer be aa, and the jury's answer be bb. Your answer is accepted if and only if ∣a−b∣max⁡(1,∣b∣)≤10−4\frac{|a - b|}{\max{(1, |b|)}} \le 10^{-4}.

输出一个实数 rr,表示包含至少 kk 个鸟类栖息地的公园的最小半径。保证给定输入总存在满足 r≤2⋅105r \leq 2 \cdot 10^5 的解。

若你的答案的绝对误差或相对误差不超过 10−410^{-4},则视为正确。

形式化地,设你的答案为 aa,评测机的答案为 bb。当且仅当 ∣a−b∣max⁡(1,∣b∣)≤10−4\frac{|a - b|}{\max{(1, |b|)}} \le 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)(-3, -1) with radius 10≈3.162\sqrt{10} \approx 3.162. It can be proven this is the minimum rr.

The following illustrates the first example. The blue points represent bird habitats and the red circle represents the amusement park.

在第一个例子中,Chanek 先生可以将公园的中心设在 (−3,−1)(-3, -1),半径为 10≈3.162\sqrt{10} \approx 3.162。可以证明这是最小的 rr。

以下图示展示了第一个例子:蓝色点表示鸟类栖息地,红色圆圈表示游乐园。

输入解题思路,AI测评打分。不知道怎么写?

首页