#P7059. [NWRRC2015] Lucky Chances
[NWRRC2015] Lucky Chances
题目描述
Lucky Chances is a lottery game. Each lottery ticket has a play field and a scratch area. The play field is a rectangular 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
Scratched ticket
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 and -- the number of rows and columns in the grid .
The following lines contain integers each -- the numbers printed on the grid. Each number is positive and does not exceed .
输出格式
Output a single integer -- the total number of winning directions for the given grid.
题目大意
有一个名叫 Lucky chances 的游戏,游戏一开始给出一个 的矩阵,你可以选定矩阵中任意一个元素以及上、下、左、右四个方向中的任意一个方向进行游戏。如果这个方向上的任意一个元素都严格小于所选的元素,那么你就赢了。
试求出所有元素的能够使得你赢得游戏的方向的总和。
Translated by Eason_AC
2020.11.15
3 4
5 3 9 10
1 8 8 2
4 3 4 3
25
提示
Time limit: 2 s, Memory limit: 256 MB.