#include <bits/stdc++.h>
using namespace std;
#define inf -1e9
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];
}
vector <vector <int> > lu, ru, ld, rd;
rd.resize(n, vector <int> (m, inf));
lu.resize(n, vector <int> (m, inf));
ru.resize(n, vector <int> (m, inf));
ld.resize(n, vector <int> (m, inf));
for(int i = 0; i < n; i ++) {
for(int j = 0; j < m; j ++) {
rd[i][j] = g[i][j] + i + j;
if(i) rd[i][j] = min(rd[i][j], rd[i-1][j]);
if(j) rd[i][j] = min(rd[i][j], rd[i][j-1]);
}
}
int ans = -1e9;
for(int i = 0; i < n; i ++) {
for(int j = 0; j < m; j ++) {
ans = max(ans, g[i][j] - rd[i][j] - (i+j));
}
}
cout << ans-1;
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 |
Incorrect |
1 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 |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
204 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |