#489
Unrated
Social Distancing
시간 제한
2s
메모리 제한
1024MB
제출
0
정답
0
맞힌 사람
0
정답 비율
0.0%

문제

Farmer John is worried for the health of his cows after an outbreak of the highly contagious bovine disease COWVID-19.

In order to limit transmission of the disease, Farmer John's NN cows (2N1052 \leq N \leq 10^5) have decided to practice "social distancing" and spread themselves out across the farm. The farm is shaped like a 1D number line, with MM mutually-disjoint intervals (1M1051 \leq M \leq 10^5) in which there is grass for grazing. The cows want to locate themselves at distinct integer points, each covered in grass, so as to maximize the value of DD, where DD represents the distance between the closest pair of cows. Please help the cows determine the largest possible value of DD.

입력

The first line of input contains NN and MM. The next MM lines each describe an interval in terms of two integers aa and bb, where 0ab10180 \leq a \leq b \leq 10^{18}. No two intervals overlap or touch at their endpoints. A cow standing on the endpoint of an interval counts as standing on grass.

출력

Print the largest possible value of DD such that all pairs of cows are DD units apart. A solution with D>0D>0 is guaranteed to exist.

예제 입력 1

5 3
0 2
4 7
9 9

예제 출력 1

2

점수

Test cases 2-3 satisfy b105.b\le 10^5. Test cases 4-10 satisfy no additional constraints.

코드 제출

코드를 제출하려면 로그인이 필요합니다.

로그인
내 제출
제출 내역이 없습니다.
맞은 사람
아직 맞은 사람이 없습니다.
난이도 투표
Unrated0명 투표
로그인 후 AC 받으면 투표할 수 있습니다.
전체 제출
제출 내역이 없습니다.