아직 만들고 있는 페이지입니다.

이 페이지는 아직 만드는 중입니다. 보이는 내용은 바뀔 수 있습니다.

Flying Doors

시간 제한2초메모리 제한1024 MB

요약
움직이는 n개의 문 천장이 주어질 때, Kostya가 어떤 속도로든 모든 문을 통과할 수 있는 시작 높이의 측도를 최소로 만드는 순서를 찾는다.
난이도

보통10점 중 7점

유형
정렬, 그리디, 수학, 구간
정답자
아직 제출이 없습니다

문제

Artem and Kostya are playing a following game. Artem has nn doors with free ceiling. The floors of the doors are fixed on zero height, ceiling could change. Each door has two parameters a_i,b_ia\_i, b\_i: a_ia\_i is the initial height of the ceiling, and b_ib\_i is the velocity of the ceiling. If b_i>0b\_i > 0, then the ceiling is moving up b_ib\_i meters per second. If b_i<0b\_i < 0, then the ceiling is moving down −b_i-b\_i meters per second until it becomes zero, after that it stops. And if b_i=0b\_i = 0, the ceiling is always fixed at height a_ia\_i.

The game proceeds as follows: Artem places these nn doors at points on 0X0X-axis with coordinates 1,2,…,n1, 2, \ldots, n in some order. Kostya is located at point x=0x = 0 just before the game. He chooses some height h≥0h \ge 0 and velocity v>0v > 0 (here we consider Kostya as a point). Then Artem shoots the starting pistol, and the doors' ceilings begin to move and simultaneously Kostya starts his journey on constant height hh with constant velocity vv in the positive direction of 0X0X-axis. Kostya must fly through all the doors. So, if Kostya flies through some coordinate ii and the ceiling of the door at coordinate ii is strictly down Kostya, then Kostya loses.

To make the game more exciting, Kostya decided to choose a randomized strategy. He chooses the height hh as a uniformly distributed on \[0;109]\[0; 10^9] real number. Then he chooses some v>0v > 0 which allows him to win, if it is possible. For each arrangement of doors consider the probability of Kostya's win if he uses this strategy. Artem wants to place doors in such order that this probability is minimized. Help Artem to find this minimal probability. To make the answer format more convenient, output the desired probability multiplied by 10910^9.

입력

The first line of input contains one positive integer nn (1≤n≤5⋅1051 \le n \le 5 \cdot 10^5) --- the number of doors Artem has.

Next nn lines contain description of doors, each of them contain two integers a_i,b_ia\_i, b\_i (1≤a_i≤109,∣b_i∣≤1091 \le a\_i \le 10^9, |b\_i| \le 10^9), denoting the initial height and the velocity of the ceiling of the ii-th door.

출력

In the only line output a real number --- the minimal probability of Kostya's win, multiplied by 10910^9. The answer will be considered correct if the absolute or relative error is less than 10−610^{-6}. Note that this rule applies to the output value, not to the desired probability.

예제2

  1. 예제 1

    입력
    3
    1 2
    3 -2
    2 1
    
    예상 출력
    1.5000000000
    
  2. 예제 2

    입력
    1
    1 2
    
    예상 출력
    1000000000.0000000000