Under construction

Still being built. Things may change

Trick or Treat

Time limit1sMemory limit128 MB

Summary
Find the point on the x-axis minimizing the maximum distance to a set of given points, an application of ternary search on a convex function.
Level

Medium4 of 10

Topics
Binary search, Math, Geometry
Solved
No attempts yet

Problem

On Halloween night, Johnny and his friends collect candy from the houses of their village. The village is large, so instead of walking to every house one after another they split up: each child walks to exactly one house, grabs the candy instantly (or wreaks a little havoc if the residents refuse), and walks straight back to a meeting point agreed on in advance. Everyone wants to start eating as soon as possible, so the feast begins the moment the last child returns.

There are nn houses, given by their Cartesian coordinates on the plane, and Johnny's gang has exactly nn children (including Johnny himself). To stay clear of the local authorities, they agree to meet somewhere along the river that runs through the village, the line y=0y = 0. Houses may lie on either side of the river, and some may even sit on it (a houseboat with y=0y = 0).

Every child walks at 11 meter per second and may move in any direction. Exactly at midnight each child knocks on the door of the assigned house, takes the candy instantly, and returns to the meeting point along the shortest straight-line path. Because there are as many children as houses, all houses are visited at once, so the time the feast begins equals the greatest distance from any house to the meeting point.

Choose the meeting point on the river y=0y = 0 that makes this time as small as possible, and report that minimum time.

Input

The input contains several test cases. Each test case begins with a line holding the number of houses nn (1≤n≤500001 \le n \le 50000). The next nn lines each contain two real numbers xx and yy (−200000≤x,y≤200000-200000 \le x, y \le 200000), the coordinates of a house in meters. All houses in one test case are at distinct positions. A blank line follows each test case. A line containing a single 00 marks the end of the input and must not be processed.

Output

For each test case, print one line with the minimum possible time, in seconds after midnight, at which the last child can reach the best meeting point on the river y=0y = 0. Print the value rounded to the nearest number with exactly six digits after the decimal point (as produced by printf("%.6f")). No test case has a true value that lies on a half-way rounding boundary.

Examples4

  1. Example 1

    Input
    2
    1.5 1.5
    3 0
    
    1
    0 0
    
    4
    1 4
    4 4
    -3 3
    2 4
    
    5
    4 7
    -4 0
    7 -6
    -2 4
    8 -5
    
    0
    
    Expected output
    1.500000
    0.000000
    5.000000
    7.136364
    
  2. Example 2

    Input
    1
    5 0
    
    0
    
    Expected output
    0.000000
    
  3. Example 3

    Input
    1
    0 4
    
    0
    
    Expected output
    4.000000
    
  4. Example 4

    Input
    2
    -4 0
    4 0
    
    0
    
    Expected output
    4.000000