#include <bits/stdc++.h>
using namespace std;
#define ff first;
#define ss second
#define pb push_back
#define int long long
int n,m,a[1005][1005],mx;
signed main(){
cin>>n>>m;
for(int i=1;i<=n;i++){
for(int j=1;j<=m;j++){
cin>>a[i][j];
}
}
mx=-INT_MAX;
for(int i=1;i<=n;i++){
for(int j=1;j<=m;j++){
for(int i1=1;i1<=n;i1++){
for(int j1=1;j1<=m;j1++){
mx=max(mx,a[i][j]-a[i1][j1]-abs(i-i1)-abs(j-j1)-1);
}
}
}
}
cout<<mx<<endl;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
1 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
348 KB |
Output is correct |
2 |
Correct |
2 ms |
604 KB |
Output is correct |
3 |
Correct |
2 ms |
344 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
1 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
8 ms |
2396 KB |
Output is correct |
10 |
Correct |
8 ms |
2396 KB |
Output is correct |
11 |
Correct |
8 ms |
2396 KB |
Output is correct |
12 |
Correct |
7 ms |
2620 KB |
Output is correct |
13 |
Correct |
8 ms |
2396 KB |
Output is correct |
14 |
Correct |
8 ms |
2608 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
1 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
2 ms |
348 KB |
Output is correct |
10 |
Correct |
2 ms |
604 KB |
Output is correct |
11 |
Correct |
2 ms |
344 KB |
Output is correct |
12 |
Correct |
8 ms |
2396 KB |
Output is correct |
13 |
Correct |
8 ms |
2396 KB |
Output is correct |
14 |
Correct |
8 ms |
2396 KB |
Output is correct |
15 |
Correct |
7 ms |
2620 KB |
Output is correct |
16 |
Correct |
8 ms |
2396 KB |
Output is correct |
17 |
Correct |
8 ms |
2608 KB |
Output is correct |
18 |
Execution timed out |
1053 ms |
16596 KB |
Time limit exceeded |
19 |
Halted |
0 ms |
0 KB |
- |