You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
621 B
26 lines
621 B
2 years ago
|
#include <bits/stdc++.h>
|
||
|
using namespace std;
|
||
|
const int N = 130;
|
||
|
int a[N][N], s[N][N];
|
||
|
int main() {
|
||
|
int n, res = INT_MIN;
|
||
|
cin >> n;
|
||
|
for (int i = 1; i <= n; i++)
|
||
|
for (int j = 1; j <= n; j++) {
|
||
|
cin >> a[i][j];
|
||
|
s[i][j] = s[i - 1][j] + a[i][j];
|
||
|
}
|
||
|
|
||
|
for (int i = 1; i <= n; ++i) {
|
||
|
for (int j = 0; j < i; ++j) {
|
||
|
int _s = 0;
|
||
|
for (int k = 1; k <= n; ++k) {
|
||
|
_s = max(_s, 0) + s[i][k] - s[j][k];
|
||
|
res = max(res, _s);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
cout << res << '\n';
|
||
|
return 0;
|
||
|
}
|