시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 1024 MB24141458.333%

문제

Tonight is finally your chance to experience one of the most mystifying phenomena the earth has to offer: the Aurora Borealis. A week ago you begged your parents to let you go out to the countryside this evening, and luckily they gave you the green light. You put on warm clothes, fill your flask with hot coffee, and prepare a quick snack. It seems like conditions are perfect; there is only a single cloud on the horizon and you look forward to the beautiful prismatic display.

However, reality once agains rears its ugly head. Every time you try to look at the Aurora Borealis, this stupid single cloud is in the way! You cannot believe the bad luck you are having, but you do not get a single look at the Aurora Borealis that night.

Disgruntled and disillusioned you head back home and try to make the best of the short amount of sleep you have left. Unfortunately, anger-induced insomnia gets the best of you and you start thinking about this annoying cloud. You feel like you got disproportionally unlucky, and in order to get some peace of mind you decide to calculate how large the cloud had to be in order to foil your sightseeing plans so effectively.

You model the sky as the real line, and the cloud as a closed interval, obscuring from view any point in this interval. You assume the speed of the cloud can never exceed $1$ m/s. Whenever you looked at the sky, you wrote down the exact time it was and the exact position you looked at. Given this information, what is the smallest length the cloud could have so that the Aurora Borealis remained hidden to you?

입력

The input consists of:

  • A line containing the integer $n$ ($1 \leq n \leq 3 \cdot 10^5$), the number of times you looked at the sky.
  • $n$ lines, each with two integers $t$ and $x$ ($0 \leq t, x \leq 10^{12}$), the time and position of one of the attempts to see the Aurora.

The times in the input are all unique.

출력

Output the minimum possible length of the cloud that would be able to keep you from seeing the Aurora. It can be proven that the result is always an integer.

예제 입력 1

5
3 1
5 5
2 3
8 9
0 0

예제 출력 1

3

예제 입력 2

3
1 1
5 2
10 1

예제 출력 2

0

예제 입력 3

5
0 0
1000000000 1000000000
110000000000 80000000000
10000000000 10000000000
100000000000 100000000000

예제 출력 3

10000000000

출처

ICPC > Regionals > Europe > Northwestern European Regional Contest > NWERC 2021 PA번

  • 문제를 만든 사람: Jorke de Vlas, Nils Gustafsson