This page is still under construction.

Parts of this page are still being built. What you see may change.

Reconnaissance

Time limit3sMemory limit256 MB

Summary
Find the minimum distance between the leading and trailing vehicles over all future times given their positions and constant velocities.
Level

Medium5 of 10

Topics
Binary search, Math
Solved
No attempts yet

Problem

You have located a major supply line the enemy has been using. Satellite imaging gives you the current position and velocity of every vehicle on that line. The supply line is an infinitely long straight line for all practical purposes, each vehicle moves at a constant velocity, and vehicles pass one another without incident.

You now want to deploy an air drone carrying a special sensor that reads the contents of the vehicles. The sensor reads everything within its range instantly, but power limits let it fire only once. To keep the required range small, send the drone at the moment the vehicles are packed as tightly as possible.

Call the present moment time 00. At time t≥0t \ge 0, the length of the shortest interval covering all vehicles is the distance between the leading vehicle and the trailing vehicle at that moment. Given the current position and velocity of every vehicle, find the smallest such length over all t≥0t \ge 0.

Input

The input holds several test cases.

Each test case begins with a line containing the number of vehicles nn (1≤n≤1000001 \le n \le 100000). Each of the next nn lines contains two integers xx and vv (−100000≤x,v≤100000-100000 \le x, v \le 100000), the position of that vehicle in meters and its velocity in meters per hour. The sign of vv gives the direction of travel.

The input ends with a line containing a single 00.

Output

For each test case, print on its own line the minimum length of an interval that covers all of the vehicles at some moment, in meters.

Round the value to two decimal places and print exactly two digits after the decimal point. Do not put spaces inside a line, and do not print blank lines between outputs.

Examples3

  1. Example 1

    Input
    2
    -100 1
    100 -1
    3
    -100 1
    100 -1
    101 -1
    3
    -100 -1
    0 0
    100 1
    0
    
    Expected output
    0.00
    1.00
    200.00
    
  2. Example 2

    Input
    1
    0 0
    1
    -100000 100000
    4
    5 -3
    5 -3
    5 -3
    5 -3
    0
    
    Expected output
    0.00
    0.00
    0.00
    
  3. Example 3

    Input
    3
    0 5
    10 5
    25 5
    3
    0 7
    1 -2
    20 -1
    3
    0 3
    100 -4
    50 1
    0
    
    Expected output
    25.00
    19.11
    21.43