复习
#include<cstdio>
#include<cstdlib>
#include<algorithm>
using namespace std;
const int N=505;
int n,m,a[N][N];
int lft[N][N],rgt[N][N],hgt[N][N];
int main(){
freopen("t.in","r",stdin);
freopen("t.out","w",stdout);
scanf("%d%d",&m,&n);
for (int i=1;i<=n;i++) for (int j=1;j<=m;j++) scanf("%d",&a[i][j]);
for (int i=1;i<=n;i++){
int l,r;
for (int j=1;j<=m;)
if (a[i][j]){
int l=j,r=j;
while (r+1<=n && a[i][r+1]) r++;
for (int k=l;k<=r;k++)
lft[i][k]=l,rgt[i][k]=r;
j=r+1;
}else
j++;
for (int j=1;j<=m;j++)
if (a[i][j]){
if (i==1 || !a[i-1][j])
hgt[i][j]=1;
else
hgt[i][j]=hgt[i-1][j]+1;
}
}
int ans=0;
for (int i=1;i<=n;i++)
for (int j=1;j<=m;j++)
if (a[i][j]){
if (i!=1 && a[i-1][j])
lft[i][j]=max(lft[i][j],lft[i-1][j]),rgt[i][j]=min(rgt[i][j],rgt[i-1][j]);
ans=max(ans,hgt[i][j]*(rgt[i][j]-lft[i][j]+1));
}
printf("%d\n",ans);
return 0;
}