#include <iostream>
#include <cmath>
using namespace std;
long long i, j, x, y, s[1001][1001], n, m, maxi = -10000000000000000, poz;
int main()
{
cin >> n >> m;
for ( i = 1; i <= n; i++ ) {
for ( j = 1; j <= m; j++ ) {
cin >> s[i][j];
}
}
for ( i = 1; i <= n; i++ ) {
for ( j = 1; j <= m; j++ ) {
for ( x = 1; x <= n; x++ ) {
for ( y = 1; y <= m; y++ ) {
if ( x != i || y != j ) {
poz = abs ( x-i );
poz += abs ( y-j );
maxi = max ( maxi, abs(s[i][j]-s[x][y])-poz-1);
}
}
}
}
}
cout << maxi;
return 0;
}
| # | 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... |