CF1190E.Tokitsukaze and Explosion

NOI/NOI+/CTSC

通过率:0%

时间限制:6.00s

内存限制:256MB

AC君温馨提醒

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

题目描述

Tokitsukaze and her friends are trying to infiltrate a secret base built by Claris. However, Claris has been aware of that and set a bomb which is going to explode in a minute. Although they try to escape, they have no place to go after they find that the door has been locked.

At this very moment, CJB, Father of Tokitsukaze comes. With his magical power given by Ereshkigal, the goddess of the underworld, CJB is able to set mm barriers to protect them from the explosion. Formally, let's build a Cartesian coordinate system on the plane and assume the bomb is at O(0,0)O(0, 0). There are nn persons in Tokitsukaze's crew, the ii-th one of whom is at Pi(Xi,Yi)P_i(X_i, Y_i). Every barrier can be considered as a line with infinity length and they can intersect each other. For every person from Tokitsukaze's crew, there must be at least one barrier separating the bomb and him, which means the line between the bomb and him intersects with at least one barrier. In this definition, if there exists a person standing at the position of the bomb, any line through O(0,0)O(0, 0) will satisfy the requirement.

Although CJB is very powerful, he still wants his barriers to be as far from the bomb as possible, in order to conserve his energy. Please help him calculate the maximum distance between the bomb and the closest barrier while all of Tokitsukaze's crew are safe.

Tokitsukaze 和她的朋友们正试图潜入 Claris 建造的一处秘密基地。然而,Claris 已察觉此事,并安置了一枚将在一分钟内爆炸的炸弹。尽管他们试图逃离,却发现大门已被锁死,无处可逃。

就在此千钧一发之际,Tokitsukaze 的父亲 CJB 赶到。凭借冥界女神埃列什基伽勒(Ereshkigal)赐予的魔法力量,CJB 可以设置 mm 道屏障,以保护众人免受爆炸伤害。形式化地,我们在平面上建立一个笛卡尔坐标系,并设炸弹位于原点 O(0,0)O(0, 0)。Tokitsukaze 的队伍中共有 nn 人,其中第 ii 个人位于点 Pi(Xi,Yi)P_i(X_i, Y_i)。每道屏障可视为一条无限长的直线,屏障之间可以相互交叉。对于 Tokitsukaze 队伍中的每一个人,必须至少存在一道屏障将炸弹与他分隔开——即连接炸弹与该人的线段(或其所在直线)至少与一道屏障相交。按此定义,若某人恰好站在炸弹位置(即原点 O(0,0)O(0, 0)),则任意一条过 O(0,0)O(0, 0) 的直线均满足要求。

尽管 CJB 实力强大,他仍希望所设屏障尽可能远离炸弹,以节省自身能量。请你帮助他计算:在确保 Tokitsukaze 全体队员安全的前提下,离炸弹最近的那道屏障所能达到的最大距离。

输入格式

The first line contains two integers nn, mm (1≤n,m≤1051 \leq n, m \leq 10^5), indicating the number of people and the number of barriers respectively.

The ii-th line of the next nn lines contains two integers XiX_i, YiY_i (−105≤Xi,Yi≤105-10^5 \leq X_i, Y_i \leq 10^5), indicating the ii-th person's location Pi(Xi,Yi)P_i(X_i, Y_i). Note that PiP_i may have the same coordinates as PjP_j (j≠ij \neq i) or even OO.

第一行包含两个整数 nn、mm(1≤n,m≤1051 \leq n, m \leq 10^5),分别表示人数和障碍物数量。

接下来的 nn 行中,第 ii 行包含两个整数 XiX_i、YiY_i(−105≤Xi,Yi≤105-10^5 \leq X_i, Y_i \leq 10^5),表示第 ii 个人的位置 Pi(Xi,Yi)P_i(X_i, Y_i)。注意:PiP_i 可能与 PjP_j(j≠ij \neq i)或原点 OO 具有相同的坐标。

输出格式

Print a single real number — the maximum distance meeting the requirement. Your answer is considered correct if its absolute or relative error does not exceed 10−610^{-6}.

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−6\frac{|a - b|}{\max(1, |b|)} \leq 10^{-6}.

输出一个实数——满足要求的最大距离。若你的答案的绝对误差或相对误差不超过 10−610^{-6},则视为正确。

形式化地,设你的答案为 aa,评测组的答案为 bb。当且仅当 ∣a−b∣max⁡(1,∣b∣)≤10−6\frac{|a - b|}{\max(1, |b|)} \leq 10^{-6} 时,你的答案被接受。

输入输出样例

  • 输入#1

    3 1
    2 0
    0 2
    -1 0

    输出#1

    0.0000000000
  • 输入#2

    1 1
    0 0

    输出#2

    0.0000000000
  • 输入#3

    2 1
    -1 -1
    -1 -1

    输出#3

    1.4142135617
  • 输入#4

    3 100000
    3 2
    -1 -3
    2 -5

    输出#4

    3.1622776602

说明/提示

In the first two examples, CJB must set the barrier crossing O(0,0)O(0, 0).

In the last two examples, CJB can set each barrier crossing some PiP_i such that the barrier is perpendicular to the line between PiP_i and OO.

在前两个示例中,CJB 必须将障碍物的穿越点设为 O(0,0)O(0, 0)。

在后两个示例中,CJB 可以将每个障碍物的穿越点设为某个 PiP_i,使得该障碍物垂直于线段 PiOP_iO。

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

首页