#include <iostream>
#define int long long
using namespace std;
int a[1005][1005];
signed main()
{
int n, m;
cin>>n>>m;
for(int i = 1; i <= n; i++)
for(int j = 1; j <= m; j++)
cin>>a[i][j];
int maxx = -1;
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(i1 != j1 || i2 != j2)
{
int n1, n2, n3;
n1 = max(a[i1][j1], a[i2][j2]);
n2 = min(a[i1][j1], a[i2][j2]);
n3 = (abs(i1 - i2) + abs(j1 - j2) + 1);
maxx = max((n1 - n2 - n3), maxx);
}
}
}
}
}
cout<<maxx<<'\n';
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
308 KB |
Output is correct |
5 |
Incorrect |
0 ms |
312 KB |
Output isn't correct |
6 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
212 KB |
Output is correct |
2 |
Correct |
4 ms |
312 KB |
Output is correct |
3 |
Correct |
4 ms |
212 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
308 KB |
Output is correct |
5 |
Incorrect |
0 ms |
312 KB |
Output isn't correct |
6 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
308 KB |
Output is correct |
5 |
Incorrect |
0 ms |
312 KB |
Output isn't correct |
6 |
Halted |
0 ms |
0 KB |
- |