Radio Receiver
InterviewTime limit5sMemory limit512 MB
Find the smallest radius D that lets a person moving at speed one stay within D of each broadcast at its sending time.
- Level
Medium6 of 10
- Topics
- Binary search, Intervals, Sorting
- Solved
- No attempts yet
Problem
You have a radio receiver and want to receive messages. Each message is sent at a fixed time, measured in seconds, from a fixed position, measured in meters from the origin. You stand on a line, so your position is a single real number. You receive a message if, at the moment it is sent, the distance between you and its sending position is at most meters. is a nonnegative real number.
You choose your starting position freely and you move at a speed of at most one meter per second. Receiving a message takes no time. Find the smallest that lets you receive every message.
Input
The first line contains the number of test cases, .
The first line of each test case contains the number of messages, . Each of the next lines contains two integers and separated by one space. is the position the message is sent from and is the time it is sent. Within one test case all sending times are distinct.
Limits
Output
For each test case, print one line in the form Case #x: D, where is the test case number starting at 1 and is the smallest that receives every message.
The answer is always a multiple of , so print exactly one digit after the decimal point. An answer of 6 is written 6.0 and an answer of 1.5 is written 1.5.
Note
In the first test case of the first example, is enough. Start at position 13 at time 2 and receive the message sent from 7. Walk right and arrive at position 14 at time 3 to receive the message sent from 20. Then walk left and arrive at position 6 at time 11 to receive the message sent from 0.