CF887E.Little Brother

普及/提高-

通过率:0%

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 101210^{12} . It should be held for hacks as well.

输入格式

First line contains four integers x1x1 , y1y1 , x2x2 , y2y2 ( 105<=x1,y1,x2,y2<=105-10^{5}<=x1,y1,x2,y2<=10^{5} ) — coordinates of points that brother drew. First point has coordinates ( x1x1 , y1y1 ) and second point has coordinates ( x2x2 , y2y2 ). These two points are different.

The second line contains single integer nn ( 1<=n<=1051<=n<=10^{5} ) — the number of circles that brother drew.

Next nn lines contains descriptions of circles. Each line contains three integers xix_{i} , yiy_{i} , rir_{i} ( 105<=xi,yi<=105-10^{5}<=x_{i},y_{i}<=10^{5} , 1<=ri<=1051<=r_{i}<=10^{5} ) describing circle with center ( xix_{i} , yiy_{i} ) and radius 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 10410^{-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

说明/提示

首页