# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
523717 | maks007 | Maxcomp (info1cup18_maxcomp) | C++14 | 1 ms | 204 KiB |
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;
int dis(pair <int,int>a, pair <int,int> b) {
return abs(a.first - b.first) + abs(a.second - b.second);
}
int main(void) {
int n, m;
cin >> n >> m;
vector <vector <int> > g(n, vector <int> (m));
for(int i = 0; i < n; i ++) {
for(int j = 0; j < m; j ++) cin >> g[i][j];
}
int ans = -1e9;
int mx = -1e9;
int i, j;
for(int k = 0; k < n; k ++) {
for(int l = 0; l < m; l ++) {
if(g[k][l] > mx) {
mx = g[k][l];
i = k;
j = l;
}
}
}
for(int k = 0; k < n; k ++) {
for(int l = 0; l < m; l ++) {
ans = max(ans, g[i][j] - g[k][l] - (abs(i-k)+abs(j-l)+1));
}
}
cout << ans;
return false;
}
Compilation message (stderr)
# | 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... |