CF1662K.Pandemic Restrictions

普及/提高-

通过率:0%

时间限制:4.00s

内存限制:256MB

AC君温馨提醒

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

题目描述

After a long time living abroad, you have decided to move back to Italy and have to find a place to live, but things are not so easy due to the ongoing global pandemic.

Your three friends Fabio, Flavio and Francesco live at the points with coordinates (x1,y1),(x2,y2)(x_1, y_1), (x_2, y_2) and (x3,y3)(x_3, y_3), respectively. Due to the mobility restrictions in response to the pandemic, meetings are limited to 33 persons, so you will only be able to meet 22 of your friends at a time. Moreover, in order to contain the spread of the infection, the authorities have imposed the following additional measure: for each meeting, the sum of the lengths travelled by each of the attendees from their residence place to the place of the meeting must not exceed rr.

What is the minimum value of rr (which can be any nonnegative real number) for which there exists a place of residence that allows you to hold the three possible meetings involving you and two of your friends? Note that the chosen place of residence need not have integer coordinates.

在海外生活了很长时间后,你决定搬回意大利并寻找住所,但由于当前的全球疫情,事情并不那么容易。

你的三位朋友 Fabio、Flavio 和 Francesco 分别住在坐标为 (x1,y1)(x_1, y_1)、(x2,y2)(x_2, y_2) 和 (x3,y3)(x_3, y_3) 的地点。由于为应对疫情而实施的出行限制,每次聚会最多只能有 33 人参加,因此你每次只能与其中两位朋友会面。此外,为遏制感染扩散,当局还额外规定:每次聚会中,所有与会者从各自住所前往聚会地点所经过的路程长度之和不得超过 rr。

请问:使得存在某个居住地点,让你能够分别与每两位朋友举行这三种可能的聚会(即你与 Fabio 和 Flavio、你与 Fabio 和 Francesco、你与 Flavio 和 Francesco)的最小 rr 值是多少?(rr 可取任意非负实数)注意:所选居住地点的坐标不一定是整数。

输入格式

The first line contains the two integers x1,y1x_1, y_1 (−104≤x1,y1≤104-10^4 \le x_1, y_1 \le 10^4) — the coordinates of the house of your friend Fabio.

The second line contains the two integers x2,y2x_2, y_2 (−104≤x2,y2≤104-10^4 \le x_2, y_2 \le 10^4) — the coordinates of the house of your friend Flavio.

The third line contains the two integers x3,y3x_3, y_3 (−104≤x3,y3≤104-10^4 \le x_3, y_3 \le 10^4) — the coordinates of the house of your friend Francesco.

It is guaranteed that your three friends live in different places (i.e., the three points (x1,y1)(x_1, y_1), (x2,y2)(x_2, y_2), (x3,y3)(x_3, y_3) are guaranteed to be distinct).

第一行包含两个整数 x1,y1x_1, y_1(−104≤x1,y1≤104-10^4 \le x_1, y_1 \le 10^4)——你的朋友 Fabio 的住所坐标。
第二行包含两个整数 x2,y2x_2, y_2(−104≤x2,y2≤104-10^4 \le x_2, y_2 \le 10^4)——你的朋友 Flavio 的住所坐标。
第三行包含两个整数 x3,y3x_3, y_3(−104≤x3,y3≤104-10^4 \le x_3, y_3 \le 10^4)——你的朋友 Francesco 的住所坐标。
保证你的三位朋友住在不同的地点(即三点 (x1,y1)(x_1, y_1)、(x2,y2)(x_2, y_2)、(x3,y3)(x_3, y_3) 互不相同)。

输出格式

Print the minimum value of rr which allows you to find a residence place satisfying the above conditions. 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 值。若你的答案的绝对误差或相对误差不超过 10−410^{-4},则视为正确。

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

输入输出样例

  • 输入#1

    0 0
    5 0
    3 3

    输出#1

    5.0686143166
  • 输入#2

    -1 0
    0 0
    1 0

    输出#2

    2.0000000000

说明/提示

In the first sample, Fabio, Flavio and Francesco live at the points with coordinates (0,0)(0,0), (5,0)(5,0) and (3,3)(3,3) respectively. The optimal place of residence, represented by a green house in the picture below, is at the point with coordinates (2.3842...,0.4151...)(2.3842..., 0.4151...).

For instance, it is possible for you to meet Flavio and Francesco at the point depicted below, so that the sum of the lengths travelled by the three attendees is at most (and in fact equal to) r=5.0686...r=5.0686....

In the second sample, any point on the segment (x,0): −1≤x≤1{(x,0):\ -1 \leq x \leq 1 } is an optimal place of residence.

在第一个样例中,Fabio、Flavio 和 Francesco 分别住在坐标为 (0,0)(0,0)、(5,0)(5,0) 和 (3,3)(3,3) 的点上。最优居住地点(如下图中绿色房屋所示)位于坐标为 (2.3842...,0.4151...)(2.3842..., 0.4151...) 的点处。

例如,你可以在下图所示的点处与 Flavio 和 Francesco 相会,使得三位参会者所行进的路径长度之和至多(且实际上恰好等于)r=5.0686...r = 5.0686...。

在第二个样例中,线段 {(x,0): −1≤x≤1}\{(x,0):\ -1 \leq x \leq 1\} 上的任意一点均为最优居住地点。

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

首页