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

26986번 - Corral the Cows 다국어

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

문제

Farmer John wishes to build a corral for his cows. Being finicky beasts, they demand that the corral be square and that the corral contain at least C (1 ≤ C ≤ 500) clover fields for afternoon treats. The corral's edges must be parallel to the X,Y axes.

FJ's land contains a total of N (C ≤ N ≤ 500) clover fields, each a block of size 1 x 1 and located at with its lower left corner at integer X and Y coordinates each in the range 1..10,000. Sometimes more than one clover field grows at the same location; such a field would have its location appear twice (or more) in the input. A corral surrounds a clover field if the field is entirely located inside the corral's borders.

Help FJ by telling him the side length of the smallest square containing C clover fields.

입력

  • Line 1: Two space-separated integers: C and N
  • Lines 2..N+1: Each line contains two space-separated integers that are the X,Y coordinates of a clover field.

출력

  • Line 1: A single line with a single integer that is length of one edge of the minimum size square that contains at least C clover fields.

제한

예제 입력 1

3 4
1 2
2 1
4 1
5 2

예제 출력 1

4

힌트

출처

Olympiad > USA Computing Olympiad > 2005-2006 Season > USACO January 2006 Contest > Gold ?번

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

출처

대학교 대회

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

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