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

27121번 - Big Barn 다국어채점 준비 중

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

문제

Farmer John wants to place a big square barn on his square farm. He hates to cut down trees on his farm and wants to find a location for his barn that enables him to build it only on land that is already clear of trees. For our purposes, his land is divided into N x N parcels. The input contains a list of parcels that contain trees. Your job is to determine and report the largest possible square barn that can be placed on his land without having to clear away trees. The barn sides must be parallel to the horizontal or vertical axis.

Consider the following grid of Farmer John's land where '.' represents a parcel with no trees and '#' represents a parcel with trees:

 1 2 3 4 5 6 7 8
1 . . . . . . . .
2 . # . . . # . .
3 . . . . . . . .
4 . . . . . . . .
5 . . . . . . . .
6 . . # . . . . .
7 . . . . . . . .
8 . . . . . . . .

The largest barn is 5 x 5 and can be placed in either of two locations in the lower right part of the grid.

입력

  • Line 1: two integers: N (1 ≤ N ≤ 200), the number of parcels on a side, and T (1 ≤ T ≤ 500) the number of parcels with trees
  • Line 2..T+1: two integers (1 ≤ each integer ≤ N), the row and column of a tree parcel

출력

The output file should consist of exactly one line, the maximum side length of John's barn.

제한

예제 입력 1

8 3
2 2
2 6
6 3

예제 출력 1

5

힌트

출처

Olympiad > USA Computing Olympiad > 1998-1999 Season > USACO National Championship 1999 > Contest 4번

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

출처

대학교 대회

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

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