406585: GYM102448 D Drinking to turn red

Memory Limit:256 MB Time Limit:2 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

D. Drinking to turn redtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard output

After the closing ceremony of an ICPC competition, Lucas and his friend decided to go to the hotel pool to have some magical drinks. After a while, Lucas found a magic swim ring and also realized that the swim rings had some interesting properties:

  • The swim rings are perfectly circular.
  • The swim rings do not move.
  • There may be a non-empty intersection between the swim rings in the pool.
  • The magic swim ring can absorb any swim ring it intersects or is tangent to. After absorption, the radius of the magic swim ring will be equal to the sum its current radius and the radius of the swim ring that was absorbed.
It was then that Lucas promised that his friend would become a grandmaster (red) at ForceCodes if he was able to solve a challenge. Obviously, his friend accepted the challenge, because he would love to become red and go screaming through the hotel so that everyone knew of his achievement. Since he was not feeling well after drinking some magic drinks, he decided to ask you to help him solve the problem.

Assuming the pool is an infinite plane and the swim rings are located at points ($$$X_i$$$, $$$Y_i$$$) with radius $$$R_i$$$, Lucas would like to know the smallest possible radius, such that if he places a magic swim ring centered at the point ($$$x$$$, $$$y$$$), all swim rings would be absorbed by the magic ring.

Example:

In this example, the magic swim ring (red) would need a radius of at least 1 to absorb the blue swim ring. After absorption, its new radius would be equal to 4, and then it would be able to absorb the purple swim ring.

Input

The first line of input contains three integers $$$N$$$ ($$$0 < N \le 10^5$$$) and $$$x$$$, $$$y$$$ ($$$-10^9 < x, y \le 10^9$$$), the number of swim rings and the center of the magic swim ring.

The $$$i$$$-th of the next $$$N$$$ lines contains three integers $$$X_i$$$, $$$Y_i$$$ ($$$-10^9 < X_i, Y_i \le 10^9$$$) and $$$R_i$$$($$$1 < R_i \le 10^5$$$), center and radius of the $$$i$$$-th swim ring.

Output

You must print the minimum radius the magic swim ring should have in order to solve Lucas' challenge. Your answer is considered correct if its absolute or relative error does not exceed $$$10^{-6}$$$.

ExamplesInput
2 1 1
1 7 3
5 1 3
Output
1.0000000000
Input
4 211 -458
335 369 6
-771 -753 30
193 -617 41
-27 -396 78
Output
870.3531099090

加入题单

算法标签: