0
1
mirror of https://git.sb/baoshuo/OI-codes.git synced 2024-11-23 18:48:48 +00:00

P1565 牛宫

https://www.luogu.com.cn/record/83999075
This commit is contained in:
Baoshuo Ren 2022-08-16 15:35:48 +08:00
parent 581447d2c4
commit f51cbe62a9
Signed by: baoshuo
GPG Key ID: 00CB9680AB29F51A

42
Luogu/P1565/P1565.cpp Normal file
View File

@ -0,0 +1,42 @@
#include <iostream>
#include <cmath>
using std::cin;
using std::cout;
const char endl = '\n';
const int N = 205;
int n, m;
long long g[N][N], ans;
int main() {
std::ios::sync_with_stdio(false);
cin.tie(nullptr);
cin >> n >> m;
for (int i = 1; i <= n; i++) {
for (int j = 1; j <= m; j++) {
cin >> g[i][j];
g[i][j] += g[i - 1][j] + g[i][j - 1] - g[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 (g[k][l] - g[k][j - 1] - g[i - 1][l] + g[i - 1][j - 1] >= 0) {
ans = std::max(ans, static_cast<long long>(k - i + 1) * (l - j + 1));
}
}
}
}
}
cout << ans << endl;
return 0;
}