CF1446F.Line Distance

普及/提高-

通过率:0%

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

You are given an integer kk and nn distinct points with integer coordinates on the Euclidean plane, the ii -th point has coordinates (xi,yi)(x_i, y_i) .

Consider a list of all the n(n1)2\frac{n(n - 1)}{2} pairs of points ((xi,yi),(xj,yj))((x_i, y_i), (x_j, y_j)) ( 1i<jn1 \le i < j \le n ). For every such pair, write out the distance from the line through these two points to the origin (0,0)(0, 0) .

Your goal is to calculate the kk -th smallest number among these distances.

输入格式

The first line contains two integers nn , kk ( 2n1052 \le n \le 10^5 , 1kn(n1)21 \le k \le \frac{n(n - 1)}{2} ).

The ii -th of the next nn lines contains two integers xix_i and yiy_i ( 104xi,yi104-10^4 \le x_i, y_i \le 10^4 ) — the coordinates of the ii -th point. It is guaranteed that all given points are pairwise distinct.

输出格式

You should output one number — the kk -th smallest distance from the origin. Your answer is considered correct if its absolute or relative error does not exceed 10610^{-6} .

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

输入输出样例

  • 输入#1

    4 3
    2 1
    -2 -1
    0 -1
    -2 4

    输出#1

    0.707106780737

说明/提示

There are 66 pairs of points:

  • Line 121-2 : distance 00 from the origin
  • Line 131-3 : distance 220.707106781\frac{\sqrt{2}}{2} \approx 0.707106781 from the origin
  • Line 141-4 : distance 22 from the origin
  • Line 232-3 : distance 11 from the origin
  • Line 242-4 : distance 22 from the origin
  • Line 343-4 : distance 2290.371390676\frac{2}{\sqrt{29}} \approx 0.371390676 from the origin

The third smallest distance among those is approximately 0.7071067810.707106781 .

首页