This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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;
int 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<=n;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 |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |