CF887E.Little Brother

省选/NOI-

通过率:0%

时间限制:3.00s

内存限制:512MB

AC君温馨提醒

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

题目描述

Masha's little brother draw two points on a sheet of paper. After that, he draws some circles and gave the sheet to his sister.

Masha has just returned from geometry lesson so she instantly noticed some interesting facts about brother's drawing.

At first, the line going through two points, that brother drew, doesn't intersect or touch any circle.

Also, no two circles intersect or touch, and there is no pair of circles such that one circle is located inside another.

Moreover, for each circle, Masha drew a square of the minimal area with sides parallel axis such that this circle is located inside the square and noticed that there is no two squares intersect or touch and there is no pair of squares such that one square is located inside other.

Now Masha wants to draw circle of minimal possible radius such that it goes through two points that brother drew and doesn't intersect any other circle, but other circles can touch Masha's circle and can be located inside it.

It's guaranteed, that answer won't exceed 1012. It should be held for hacks as well.

玛莎的弟弟在一张纸上画了两个点。随后,他又画了一些圆,并把这张纸交给了姐姐。

玛莎刚上完几何课,立刻注意到了弟弟这幅画中一些有趣的性质:

首先,经过弟弟所画两个点的直线,既不与任何圆相交,也不与任何圆相切。

其次,任意两个圆之间既不相交,也不相切;并且不存在一对圆,使得其中一个圆完全位于另一个圆内部。

此外,对于每个圆,玛莎都画出了一个面积最小的正方形(其边分别与坐标轴平行),使得该圆完全位于这个正方形内部;她还注意到:任意两个这样的正方形之间既不相交,也不相切;并且不存在一对正方形,使得其中一个正方形完全位于另一个正方形内部。

现在,玛莎希望画一个半径尽可能小的圆,使其恰好经过弟弟所画的那两个点,且不与任何其他圆相交(但允许与其他圆相切,也允许其他圆位于该圆内部)。

题目保证答案不超过 101210^{12},且该约束对 hack 数据同样成立。

输入格式

First line contains four integers _x_1, _y_1, _x_2, _y_2 ( - 105 ≤ _x_1, _y_1, _x_2, _y_2 ≤ 105) — coordinates of points that brother drew. First point has coordinates (_x_1, _y_1) and second point has coordinates (_x_2, _y_2). These two points are different.

The second line contains single integer n (1 ≤ n ≤ 105) — the number of circles that brother drew.

Next n lines contains descriptions of circles. Each line contains three integers x__i, y__i, r__i ( - 105 ≤ x__i, y__i ≤ 105, 1 ≤ r__i ≤ 105) describing circle with center (x__i, y__i) and radius r__i.

第一行包含四个整数 x1x_1、y1y_1、x2x_2、y2y_2(−105≤x1,y1,x2,y2≤105-10^5 \le x_1, y_1, x_2, y_2 \le 10^5),表示弟弟所画的两个点的坐标。第一个点的坐标为 (x1,y1)(x_1, y_1),第二个点的坐标为 (x2,y2)(x_2, y_2)。这两个点互不相同。

第二行包含一个整数 nn(1≤n≤1051 \le n \le 10^5)—— 弟弟所画的圆的数量。

接下来的 nn 行描述了这些圆。每行包含三个整数 xix_i、yiy_i、rir_i(−105≤xi,yi≤105-10^5 \le x_i, y_i \le 10^5,1≤ri≤1051 \le r_i \le 10^5),表示以 (xi,yi)(x_i, y_i) 为圆心、半径为 rir_i 的圆。

输出格式

Output smallest real number, that it's possible to draw a circle with such radius through given points in such a way that it doesn't intersect other circles.

The output is considered correct if it has a relative or absolute error of at most 10 - 4.

输出最小的实数,使得可以以该数值为半径作一个圆,使其经过给定的点,且不与其它圆相交。

若输出结果的相对误差或绝对误差不超过 10−410^{-4},则视为正确。

输入输出样例

  • 输入#1

    2 4 7 13
    3
    3 0 1
    12 4 2
    -4 14 2

    输出#1

    5.1478150705
  • 输入#2

    -2 3 10 -10
    2
    7 0 3
    -5 -5 2

    输出#2

    9.1481831923

说明/提示

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

首页