CF1446F.Line Distance
NOI/NOI+/CTSC
通过率:0%
时间限制:7.50s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
You are given an integer k and n distinct points with integer coordinates on the Euclidean plane, the i-th point has coordinates (xi,yi).
Consider a list of all the 2n(n−1) pairs of points ((xi,yi),(xj,yj)) (1≤i<j≤n). For every such pair, write out the distance from the line through these two points to the origin (0,0).
Your goal is to calculate the k-th smallest number among these distances.
给你一个整数 k 和平面上 n 个互不相同的整数坐标点,其中第 i 个点的坐标为 (xi,yi)。
考虑所有 2n(n−1) 个点对 ((xi,yi),(xj,yj))(其中 1≤i<j≤n)构成的列表。对每个这样的点对,计算过这两点的直线到原点 (0,0) 的距离。
你的目标是计算这些距离中第 k 小的数。
输入格式
The first line contains two integers n, k (2≤n≤105, 1≤k≤2n(n−1)).
The i-th of the next n lines contains two integers xi and yi (−104≤xi,yi≤104) — the coordinates of the i-th point. It is guaranteed that all given points are pairwise distinct.
第一行包含两个整数 n 和 k(2≤n≤105,1≤k≤2n(n−1))。
接下来的 n 行中,第 i 行包含两个整数 xi 和 yi(−104≤xi,yi≤104),表示第 i 个点的坐标。保证所有给定的点两两互不相同。
输出格式
You should output one number — the k-th smallest distance from the origin. Your answer is considered correct if its absolute or relative error does not exceed 10−6.
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−6.
你应该输出一个数字——从原点出发的第 k 小的距离。若你的答案的绝对误差或相对误差不超过 10−6,则视为正确。
形式化地,设你的答案为 a,评测组的答案为 b。当且仅当 max(1,∣b∣)∣a−b∣≤10−6 时,你的答案被接受。
输入输出样例
输入#1
4 3 2 1 -2 -1 0 -1 -2 4
输出#1
0.707106780737
说明/提示
There are 6 pairs of points:
- Line 1−2 : distance 0 from the origin
- Line 1−3 : distance 22≈0.707106781 from the origin
- Line 1−4 : distance 2 from the origin
- Line 2−3 : distance 1 from the origin
- Line 2−4 : distance 2 from the origin
- Line 3−4 : distance 292≈0.371390676 from the origin
The third smallest distance among those is approximately 0.707106781.
共有 6 对点:
- 直线 1-2:到原点的距离为 0
- 直线 1-3:到原点的距离为 22≈0.707106781
- 直线 1-4:到原点的距离为 2
- 直线 2-3:到原点的距离为 1
- 直线 2-4:到原点的距离为 2
- 直线 3-4:到原点的距离为 292≈0.371390676
其中第三小的距离约为 0.707106781。
输入解题思路,AI测评打分。不知道怎么写?