시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
---|---|---|---|---|---|
2 초 | 512 MB | 66 | 17 | 11 | 20.370% |
In a relay running race, n athletes of a team are initially positioned along a road. Specifically, the initial position of athlete i is xi (in meters from an origin). This athlete can run up to vi meters per second. Initially, each athlete holds a baton.
The race starts by blowing a whistle and finishes when any athlete of the team holds all of the batons. In any moment during the race, each athlete can run along the road (in any of the two directions), or simply stop. When two athletes meet at the same position, each of them can pass all batons she or he holds to the other athlete.
You are the coach of the team. Your task is to find the shortest possible time the team can finish the race.
In the first line of input, a single integer n (1 ≤ n ≤ 105) is given. In each of the next n lines, two space-separated integers xi (0 ≤ xi ≤ 106), and vi (1 ≤ vi ≤ 106) are given.
In the only line of the output, print a single number, the minimum amount of time the team can finish the race (in seconds). Your answer is considered to be correct if it has an absolute error of at most 10−6.
3 4 1 0 3 10 1
2.50000
1 100000 1000000
0
ICPC > Regionals > Asia West Continent > Iran > Tehran Site 2018 G번