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

8068번 - Water 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
3 초 128 MB3301208535.865%

문제

On a rectangular mesh comprising n x m fields, n⋅m cuboids were put, one cuboid on each field. A base of each cuboid covers one field and its surface equals to one square inch. Cuboids on adjacent fields adhere one to another so close that there are no gaps between them. A heavy rain pelted on a construction so that in some areas puddles of water appeared.

Write a program which:

  • reads from the standard input a size of the chessboard and heights of cuboids put on the fields,
  • computes maximal water volume, which may gather in puddles after the rain,
  • writes results to standard output.

입력

In the first line of the standard input two positive integers n and m, 1 ≤ n ≤ 100, 1 ≤ m ≤ 100 are written. They are the size of the mesh. In each of the following n lines there are m integers from the interval [1, 10,000]; i-th number in j-th line denotes a height of a cuboid given in inches put on the field in the i-th column and j-th raw of the chessboard.

출력

Your program should write in the first and the only line of the standard output one integer equal to the maximal volume of water (given in cubic inches), which may gather in puddles on the construction.

제한

예제 입력 1

3 6
3 3 4 4 4 2
3 1 3 2 1 4
7 3 1 6 4 1

예제 출력 1

5

힌트

A picture below shows the mesh after the rain (seen from above). Puddles are drawn in gray.

출처

Olympiad > Polish Olympiad in Informatics > POI 1998/1999 > Stage 3 6번

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

출처

대학교 대회

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

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