#BS0000393. Hội tụ (Get Together)
Bài tập thuộc lộ trình
Mục lục đề ⌄
Hội tụ (Get Together)
Get Together
Version: Phuoc Hung OJ Extended
PHOJ practice edition. Its constraints, input/output format, examples and judging rules are specified below.
Statement
There are people on a number line. Person starts at and has maximum speed . Each may move left, right, or remain stationary. All start simultaneously. Find the minimum time for everyone to occupy a common point.
Input
The first line contains an integer . Each of the next lines contains integers .
Output
Print the minimum time. Absolute error must not exceed . The output token may contain at most 128 characters; in scientific notation, the explicit exponent must be from -1000 to 1000.
Subtasks
- Subtask 1 (20 points): ; ; .
- Subtask 2 (30 points): ; ; .
- Subtask 3 (50 points): ; ; .
New examples
Input
2
0 1
10 1
Output
5
Explanation
The two people start at 0 and 10 with maximum speed 1 each. After 5 time units they can meet at 5. Earlier, their combined travel distance is less than 10, so they cannot meet.
Input
3
0 1
10 2
4 1
Output
3.333333333333333
Explanation
The first two people are 10 units apart, with combined maximum speed 3. They cannot meet before time . At that time they can meet at . The third person starts at 4 and needs to travel only , less than the allowed distance . Thus all three can meet then.
Input
3
-7 1
-7 3
-7 5
Output
0
Explanation
All three people start at . They already share a position, so the minimum time is zero regardless of speed.