#include <iostream>
using namespace std;
int arr[201][201];
int main(){
int n, m;
cin >> n >> m;
for(int i = 1; i <= n; ++i)
for(int j = 1; j <= m; ++j)
cin >> arr[i][j];
for(int i = 1; i <= n; ++i)
for(int j = 1; j <= m; ++j)
arr[i][j] = arr[i][j] + arr[i-1][j] + arr[i][j-1] - arr[i-1][j-1];
int ans = -1e9;
for(int x1 = 1; x1 <= n; ++x1){
for(int y1 = 1; y1 <= m; ++y1){
for(int x2 = x1; x2 <= n; ++x2){
for(int y2 = y1; y2 <= m; ++y2){
ans = max(ans, arr[x2][y2] - arr[x1-1][y2] - arr[x2][y1-1] + arr[x1-1][y1-1]);
}
}
}
}
cout << ans;
}
백준 3020 개똥벌레 혼내주기 (0) | 2021.08.01 |
---|---|
백준 5549 행성 탐사 혼내주기 (0) | 2021.08.01 |
백준 1806 부분합 혼내주기 (0) | 2021.08.01 |
백준 15961 회전 초밥 혼내주기 (0) | 2021.08.01 |
백준 2473 세 용액 혼내주기 (0) | 2021.08.01 |
댓글 영역