#P15880. [ICPC 2026 NAC] Friend Meetup

[ICPC 2026 NAC] Friend Meetup

Description

A group of friends live happily on a 2D Manhattan grid, which has a horizontal road y=ay=a running through it for every integer aa and a vertical road x=bx=b for every integer bb. Each friend is located at the intersection of two roads and has a walking speed (in grid units per second). They can only travel by moving along the roads at those speeds.

Life on the grid gets boring, so pairs of friends sometimes like to meet up. They do so by moving towards each other along routes that cause them to meet at a common point as quickly as possible. (This point does not have to be at the intersection of two roads; but does have to lie on a road, of course.) They would like to know: over all possible pairs of friends, what's the longest it could take a pair of friends to meet up?

Input Format

The first line of input contains an integer NN (2N2105)(2 \leq N \leq 2\cdot 10^5), the number of friends.

Each of the next NN lines contains three space-separated integers xx, yy, and vv (x,y106,1v106)(|x|, |y| \leq 10^6, 1 \leq v \leq 10^6), indicating a friend located at (x,y)(x,y) who travels at vv units per second along the grid.

Output Format

Print the real number of seconds it would take for a pair of friends to meet up for whom this time is the longest, assuming that each pair takes optimal routes to meet up as quickly as possible. Your answer will be accepted if it differs from the judge solution by relative or absolute error at most 10610^{-6}.

3
0 0 1
1 1 3
-1 1 4
0.5