Logo
(追記) (追記ここまで)

18877번 - Social Distancing 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 512 MB152256843137.576%

문제

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 $N$ cows (2ドル \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 $M$ mutually-disjoint intervals (1ドル \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 $D,ドル where $D$ represents the distance between the closest pair of cows. Please help the cows determine the largest possible value of $D$.

입력

The first line of input contains $N$ and $M$. The next $M$ lines each describe an interval in terms of two integers $a$ and $b,ドル where 0ドル \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 $D$ such that all pairs of cows are $D$ units apart. A solution with $D>0$ is guaranteed to exist.

제한

예제 입력 1

5 3
0 2
4 7
9 9

예제 출력 1

2

힌트

One way to achieve $D=2$ is to have cows at positions 0ドル,ドル 2ドル,ドル 4ドル,ドル 6ドル$ and 9ドル$.

출처

Olympiad > USA Computing Olympiad > 2019-2020 Season > USACO 2020 US Open Contest > Silver 1번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /