#include<bits/stdc++.h>
using namespace std;
typedef long long int lld;
lld abs(lld a){
if(a>0)return a;
return -a;
}
int main(){
int n,m;
cin>>n>>m;
lld matrix[n][m];
for(int i=0;i<n;i++){
for(int j=0;j<m;j++){
cin>>matrix[i][j];
}
}
lld ans=0;
for(int i=0;i<n;i++){
for(int j=0;j<m;j++){
for(int k=0;k<n;k++){
for(int l=0;l<m;l++){
ans=max(ans,matrix[i][j]-matrix[k][l]-abs(i-k)-abs(j-l)-1);
}
}
}
}
cout<<ans<<endl;
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
256 KB |
Output is correct |
3 |
Incorrect |
2 ms |
256 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
256 KB |
Output is correct |
2 |
Correct |
4 ms |
376 KB |
Output is correct |
3 |
Correct |
5 ms |
256 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
256 KB |
Output is correct |
3 |
Incorrect |
2 ms |
256 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
256 KB |
Output is correct |
3 |
Incorrect |
2 ms |
256 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |