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

28229번 - Ammunition Storage 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 1024 MB258733.333%

문제

The Do-Barareh military area is like an n×m grid, each cell of which has a specific height. The commander of this military area is looking for a rectangular sub-area of this area, with width and height least 2, whose its four corner cells are higher than the rest of its cells. He plans to install watchtowers in the corners of this sub-area to monitor the entire sub-area and use it for ammunition storage. Your job is to help the commander to find out how many valid sub-areas there are to choose as the ammunition storage. You can assume cell heights are distinct.

입력

The first line of input contains two space-separated integers n and m (2 ⩽ n, m ⩽ 750). Each of the next n lines contains m space-separated integers showing the cell heights. It is guaranteed cell heights are distinct numbers between 1 and nm (inclusive).

출력

Print the number of valid sub-areas to be used as an ammunition storage.

제한

예제 입력 1

3 3
9 4 8
2 1 3
7 5 6

예제 출력 1

7

힌트

출처

ICPC > Regionals > Asia West Continent > Iran > 2022 ICPC Asia Tehran Regional Contest F번

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

출처

대학교 대회

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

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