#include <bits/stdc++.h>
using namespace std;
#define int long long
signed main()
{
int n, m;
cin >> n >> m;
int a[3000][3000];
for(int i = 1; i <= n; i++)
{
for(int j = 1; j <= m; j++)
{
cin >> a[i][j];
}
}
int mx = -INT_MAX;
for(int i = 1; i <= n; i++)
{
for(int j = 1; j <= m; j++)
{
for(int r = 1; r <= n; r++)
{
for(int k = 1; k <= m; k++)
{
mx = max(mx, a[i][j] - a[r][k] - abs(i - r) - abs(j - k) - 1);
}
}
}
}
cout << mx;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
69 ms |
70732 KB |
Output is correct |
2 |
Correct |
62 ms |
70728 KB |
Output is correct |
3 |
Correct |
60 ms |
70740 KB |
Output is correct |
4 |
Correct |
69 ms |
70796 KB |
Output is correct |
5 |
Correct |
62 ms |
70724 KB |
Output is correct |
6 |
Correct |
60 ms |
70724 KB |
Output is correct |
7 |
Correct |
60 ms |
70824 KB |
Output is correct |
8 |
Correct |
58 ms |
70732 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
55 ms |
70768 KB |
Output is correct |
2 |
Correct |
54 ms |
70728 KB |
Output is correct |
3 |
Correct |
55 ms |
70728 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
69 ms |
70732 KB |
Output is correct |
2 |
Correct |
62 ms |
70728 KB |
Output is correct |
3 |
Correct |
60 ms |
70740 KB |
Output is correct |
4 |
Correct |
69 ms |
70796 KB |
Output is correct |
5 |
Correct |
62 ms |
70724 KB |
Output is correct |
6 |
Correct |
60 ms |
70724 KB |
Output is correct |
7 |
Correct |
60 ms |
70824 KB |
Output is correct |
8 |
Correct |
58 ms |
70732 KB |
Output is correct |
9 |
Correct |
60 ms |
70820 KB |
Output is correct |
10 |
Correct |
66 ms |
70632 KB |
Output is correct |
11 |
Correct |
60 ms |
70820 KB |
Output is correct |
12 |
Correct |
62 ms |
70816 KB |
Output is correct |
13 |
Correct |
60 ms |
70628 KB |
Output is correct |
14 |
Correct |
69 ms |
70748 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
69 ms |
70732 KB |
Output is correct |
2 |
Correct |
62 ms |
70728 KB |
Output is correct |
3 |
Correct |
60 ms |
70740 KB |
Output is correct |
4 |
Correct |
69 ms |
70796 KB |
Output is correct |
5 |
Correct |
62 ms |
70724 KB |
Output is correct |
6 |
Correct |
60 ms |
70724 KB |
Output is correct |
7 |
Correct |
60 ms |
70824 KB |
Output is correct |
8 |
Correct |
58 ms |
70732 KB |
Output is correct |
9 |
Correct |
55 ms |
70768 KB |
Output is correct |
10 |
Correct |
54 ms |
70728 KB |
Output is correct |
11 |
Correct |
55 ms |
70728 KB |
Output is correct |
12 |
Correct |
60 ms |
70820 KB |
Output is correct |
13 |
Correct |
66 ms |
70632 KB |
Output is correct |
14 |
Correct |
60 ms |
70820 KB |
Output is correct |
15 |
Correct |
62 ms |
70816 KB |
Output is correct |
16 |
Correct |
60 ms |
70628 KB |
Output is correct |
17 |
Correct |
69 ms |
70748 KB |
Output is correct |
18 |
Execution timed out |
1071 ms |
78988 KB |
Time limit exceeded |
19 |
Halted |
0 ms |
0 KB |
- |