#BS0000394. Điểm hẹn không thể thay đổi (The Meeting Place Cannot Be Changed)
Bài tập thuộc lộ trình
Mục lục đề ⌄
Điểm hẹn không thể thay đổi (The Meeting Place Cannot Be Changed)
The Meeting Place Cannot Be Changed
Source: Codeforces
Version: Phuoc Hung OJ Extended
Problem Statement
On a straight road in Bytecity, friends are at coordinates measured in metres from south to north. Friend starts at and can travel in either direction at a speed of at most metres per second. They wish to gather at a single point, which need not have an integer coordinate. Find the minimum time required.
Input
The first line contains integer . The second line contains integers . The third line contains integers .
Output
Print the minimum time in seconds. The absolute or relative error must not exceed .
Subtasks
- Subtask 1 (20 points): ; for every .
- Subtask 2 (30 points): ; for every .
- Subtask 3 (50 points): ; for every .
Examples
Input
3
7 1 3
1 2 1
Output
2.000000000000
Explanation
After 2 seconds the three friends reach 5 by moving 2 metres south, 4 metres north, and 2 metres north. The first two start 6 metres apart and their combined speed is at most 3, so they cannot meet sooner.
Input
4
5 10 3 2
2 3 2 4
Output
1.400000000000
Explanation
At time 1.4 the reachable intervals are , , , , sharing 5.8. Friends 2 and 3 are 7 metres apart with combined speed 5, requiring at least 1.4 seconds.