This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<bits/stdc++.h>
using namespace std;
const int mxN = 55;
int grid[mxN][mxN];
int main(){
ios_base::sync_with_stdio(0);
cin.tie(0);
int n, m;
cin >> n >> m;
for(int i = 0;i < n;++i){
for(int j = 0;j < m;++j){
cin >> grid[i][j];
}
}
int mx = -1e9;
for(int i = 0;i < n;++i){
for(int j = 0;j < m;++j){
for(int ii = 0;ii < n;++ii){
for(int jj = 0;jj < m;++jj){
mx = max(mx, abs(grid[ii][jj] - grid[i][j]) - abs(ii - i) - abs(jj - j));
}
}
}
}
cout << mx - 1 << '\n';
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |