#include <bits/stdc++.h>
using namespace std;
int dis(pair <int,int>a, pair <int,int> b) {
return abs(a.first - b.first) + abs(a.second - b.second);
}
int main(void) {
int n, m;
cin >> n >> m;
vector <vector <int> > g(n, vector <int> (m));
for(int i = 0; i < n; i ++) {
for(int j = 0; j < m; j ++) cin >> g[i][j];
}
int ans = -1e9;
for(int i = 0; i < n; i ++) {
for(int j = 0; j < m; j ++) {
for(int k = i; k < n; k ++) {
for(int l = j; l < m; l ++) {
ans = max(ans, g[i][j] - g[k][l] - (abs(i-k)+abs(j-l)+1));
}
}
}
}
cout << ans;
return false;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
204 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
204 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
204 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |