#t145. 排兵布阵
排兵布阵
Troop Deployment
Problem Description
As a general, you naturally need to deploy your troops sensibly. The map can be viewed as an grid; a cell suitable for deploying troops is marked 1, and an unsuitable cell is marked 0. Now you must choose a rectangular region on the map to deploy troops, and this rectangle must not contain any unsuitable cell. What is the maximum number of cells such a rectangle can contain?
Input Format
The first line contains two positive integers and , the numbers of rows and columns of the map grid. The following lines each contain integers , indicating whether each cell is suitable for deploying troops.
Output Format
One line: one integer, the maximum number of cells in a troop-deployment rectangle.
Sample Input
Sample Input 1
4 3
0 1 1
1 0 1
0 1 1
1 1 1
Sample Input 2
3 5
1 0 1 0 1
0 1 0 1 0
0 1 1 1 0
Sample Output
Sample Output 1
4
Sample Output 2
3
Sample Explanation
For sample 1, the map is:
0 1 1
1 0 1
0 1 1
1 1 1
You can choose the rectangle from row to row and column to column . All cells in it are 1, and its area is . So the maximum is cells.
Constraints
For all test points, , .