#include<bits/stdc++.h>
using namespace std;
int pass()
{
return 0;
}
int main()
{
//input
int n, m;
cin >> n >> m;
int a[n][m] = {0};
for (int i = 0; i < n; ++i) {
char str[m];
cin >> str;
for (int j = 0; j < m; ++j) {
if (str[j] == '0') {
a[i][j] = 1;
}
else if (str[j] == '1') {
a[i][j] = 2;
}
else {
pass;
}
}
}
//statistics
int max = 0;
//Matrix ergodicity
for (int x1 = 0; x1 <= n; ++x1) {
for (int y1 = 0; y1 <= m; ++y1) {
for (int x2 = x1; x2 <= n; ++x2) {
for (int y2 = y1; y2 <= m; ++y2) {
//Balance judgment
int white = 0, black = 0;
for (int i = 0; i < n; ++i) {
for (int j = 0; j < m; ++j) {
if (i >= x1 && i <= x2 && j >= y1 && j <= y2) {
if (a[i][j] == 1) {
white++;
}
else if (a[i][j] == 2) {
black++;
}
}
}
}
if (white == black) {
int x = x2 - x1, y = y2 - y1, area;
area = x*y;
if (max < area) {
max = area;
}
}
}
}
}
}
//output
cout << max << endl;
return 0;
}
自查了一天,一直做不出来,啊啊啊