#include <bits/stdc++.h>
#define NM 1002
using namespace std;
int n, m;
int ma[NM][NM];
int mx = -1;
int dist(int a1, int a2, int b1, int b2)
{
return abs(a2 - a1 + 1) + abs(b2 - b1 + 1) + 1;
}
int main()
{
cin >> n >> m;
for(int i = 1; i <= n; i++)
for(int j = 1; j <= m; j++)
cin >> ma[i][j];
for(int i1 = 1; i1 <= n; i1++)
for(int j1 = 1; j1 <= m; j1++)
for(int i2 = 1; i2 <= n; i2++)
for(int j2 = 1; j2 <= m; j2++)
if(abs(ma[i1][j1] - ma[i2][j2]) - dist(i1, j1, i2, j2) > mx)
mx = abs(ma[i1][j1] - ma[i2][j2]) - dist(i1, j1, i2, j2);
cout << mx << "\n";
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
504 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
5 ms |
516 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
504 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
504 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |