#t137. 黑白方块
黑白方块
Black-and-White Grid
Problem Description
Xiaoyang has a grid of rows and columns, where each cell is either white or black. For a sub-rectangle of the grid, Xiaoyang calls it balanced if it contains the same number of black cells as white cells. Xiaoyang wants to know: what is the maximum number of cells contained in a balanced sub-rectangle?
Input Format
The first line contains two positive integers and , as described.
The following lines each contain a string of length consisting of 0 and 1, representing the colors of the -th row: 0 means white, 1 means black.
Output Format
Output one integer: the maximum number of cells in a balanced sub-rectangle. If no balanced sub-rectangle exists, output .
Sample Input
4 5
00000
01111
00011
00011
Sample Output
16
Sample Explanation
In the sample, the largest balanced sub-rectangle occupies rows to and columns to (rows and columns are -indexed). This sub-rectangle has cells, of which are black and are white, so it is balanced. Thus the answer is .
Constraints
For all test data, .