#include <bits/stdc++.h>
#define int long long
#define fi first
#define se second
#define pii pair<int, int>
using namespace std;
const int MOD = 1e9 + 7;
const int MAXN = 1e5 + 11;
const int B = 800;
int a[51][51];
int32_t main(){
int n, m; cin >> n >> m;
for(int i = 0; i < n; i++){
for(int j = 0; j < m; j++){
cin >> a[i][j];
}
}
int ans = -1;
for(int x1 = 0; x1 < n; x1++){
for(int y1 = 0; y1 < m; y1++){
for(int x2 = 0; x2 < n; x2++){
for(int y2 = 0; y2 < n; y2++){
int s = abs(x1 - x2) + abs(y1 - y2) + 1;
int mx = a[x1][y1], mn = a[x1][y1];
for(int i = min(x1, x2); i <= max(x1, x2); i++){
mx = max(mx, a[i][y1]);
mn = min(mn, a[i][y1]);
}
for(int i = min(y1, y2); i <= max(y1, y2); i++){
mx = max(mx, a[x2][i]);
mn = min(mn, a[x2][i]);
}
ans = max(ans, mx - mn - s);
}
}
}
}
cout << ans << endl;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |