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

6107번 - Plumbing the Pond 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 128 MB157978865.185%

문제

Bessie's drinks water from a pond in the northwest part of the farm. It has an interesting bottom in that it is full of little hills and valleys. She wonders how deep it is.

She trolls across the pond in her little boat with a very old radar set that tends to have spurious readings. She knows the deepest part is relatively flat and has decided that she'll believe the largest depth number only if it is verified by the fact that the same depth appears in an adjacent reading.

The pond is modeled as an R x C (1 <= R <= 50; 1 <= C <= 50) grid of (positive integer) depth readings D_rc (0 <= D_rc <= 1,000,000); some readings might be 0 -- those are not part of the pond. A depth reading of 10 means "depth of 10".

Find the greatest depth that appears in at least two 'adjacent' readings (where 'adjacent' means in any of the potentially eight squares that border a square on each of its sides and its diagonals). She knows the pond has at least one pair of positive, adjacent readings.

입력

  • Line 1: Two space-separated integers: R and C
  • Lines 2..R+1: Line i+1 contains C space-separated integers that represent the depth of the pond across row i: D_rc

출력

  • Line 1: A single integer that is the depth of the pond determined by following Bessie's rules.

제한

예제 입력 1

4 3
0 1 0
1 2 0
1 5 1
2 3 4

예제 출력 1

1

힌트

Even though 5 is the deepest reading Bessie gets, and the number 2 occurs twice, 1 is the largest number that occurs in two adjacent cells.

출처

Olympiad > USA Computing Olympiad > 2008-2009 Season > USACO March 2009 Contest > Bronze 2번

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

출처

대학교 대회

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

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