#t137. 黑白方块

黑白方块

Black-and-White Grid

Problem Description

Xiaoyang has a grid of nn rows and mm 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 nn and mm, as described. The following nn lines each contain a string of length mm consisting of 0 and 1, representing the colors of the ii-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 00.

Sample Input

4 5
00000
01111
00011
00011

Sample Output

16

Sample Explanation

In the sample, the largest balanced sub-rectangle occupies rows 11 to 44 and columns 22 to 55 (rows and columns are 11-indexed). This sub-rectangle has 4×4=164 \times 4 = 16 cells, of which 88 are black and 88 are white, so it is balanced. Thus the answer is 1616.

Constraints

For all test data, 1≤n,m≤101 \le n, m \le 10.