Hide

Problem D
Marathon

/problems/lthchallenge22.marathon/file/statement/en/img-0001.png
Erik running very fast. Illustration: Maj Stenmark, CC0

Erik wants to run a marathon. Most of all, he wants to win the race. To plan his training, he has looked up how the other contestants performed in previous races and made a model to predict his chances of winning. The finishing time for each contestant is distributed uniformly at random in an interval $[a_ i, b_ i]$. What is the largest finishing time Erik can have while still having a $50\% $ change of winning?

Input

The first line contains an integer $1 \leq N \leq 10^5$, the number of other contestants. Then follows $N$ lines, each with two floating point values $0 \leq a_ i \leq 10^5$ and $a_ i \le b_ i \leq 10^5$ with at exactly one decimal place, the start and end time in seconds for their finishing time.

Output

A single real number, the largest finishing time in seconds that Erik needs to have a $50\% $ chance of winning. The answer must be with a relative or absolute error of at most $10^{-6}$.

Scoring

Group

Points

Limits

$1$

$20$

No intervals overlap.

$2$

$80$

No further restrictions.

Sample Input 1 Sample Output 1
1
1.0 3.0
2.0
Sample Input 2 Sample Output 2
3
0.0 10.0
3.5 6.7
2.2 4.5
2.883937700856755

Please log in to submit a solution to this problem

Log in