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

11477번 - Lucky Chances 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 256 MB97887989.773%

문제

Lucky Chances is a lottery game. Each lottery ticket has a play field and a scratch area. The play field is a rectangular r × c field filled with numbers. The scratch area hides row and column numbers that specify the bet cell.

There are four possible winning directions: up, down, left and right. You win a direction if all numbers in this direction from the bet cell are strictly less than a number in the bet cell. And if the bet cell is on the edge of the grid, you win the corresponding direction automatically!

Unscratched ticket

Scratched ticket 1

Scratched ticket 2

Larry wants to choose the ticket that has maximum total number of winning directions for all possible bet cells. Write a program that determines this number for the given grid.

입력

The first line of the input file contains two integers r and c — the number of rows and columns in the grid (1 ≤ r, c ≤ 100).

The following r lines contain c integers each — the numbers printed on the grid. Each number is positive and does not exceed 1000.

출력

Output a single integer w — the total number of winning directions for the given grid.

제한

예제 입력 1

3 4
5 3 9 10
1 8 8 2
4 3 4 3

예제 출력 1

25

힌트

출처

ICPC > Regionals > Northern Eurasia > Northwestern Russia Regional Contest > NEERC Northern Subregional 2015 L번

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

출처

대학교 대회

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

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