比赛 |
20240913练习 |
评测结果 |
AAAAAAAAAA |
题目名称 |
牛宫 |
最终得分 |
100 |
用户昵称 |
┭┮﹏┭┮ |
运行时间 |
2.513 s |
代码语言 |
C++ |
内存使用 |
3.72 MiB |
提交时间 |
2024-09-13 21:53:39 |
显示代码纯文本
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pii pair<int,int>
#define fi first
#define in inline
#define se second
#define mp make_pair
#define pb push_back
const int N = 210;
ll read(){
ll x = 0,f = 1;char c = getchar();
for(;c < '0' || c > '9';c = getchar())if(c == '-')f = -1;
for(;c >= '0' && c <= '9';c = getchar())x = (x<<1) + (x<<3) + c-'0';
return x * f;
}
int n,m;
ll a[N][N],ans;
int main(){
freopen("long.in","r",stdin);
freopen("long.out","w",stdout);
n = read(),m = read();
for(int i = 1;i <= n;i++)
for(int j = 1;j <= m;j++)a[i][j] = read() + a[i-1][j] + a[i][j-1] - a[i-1][j-1];
for(int i = 1;i <= n;i++){
for(int j = 1;j <= m;j++){
for(int k = i;k <= n;k++){
for(int l = j;l <= m;l++)
if(a[k][l] - a[i-1][l] - a[k][j-1] + a[i-1][j-1] >= 0)ans = max(ans,(ll)(k - i + 1) * (l - j + 1));
}
}
}
printf("%lld\n",ans);
return 0;
}