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 <iostream>
#include <map>
using namespace std;
int main()
{
long long int n, m;
cin >> n >> m;
multimap<long long int, pair<long long int, long long int>> matrix;
long long int x;
for(long long int i = 0; i < n; i++) for(long long int j = 0; j < m; j++)
{
cin >> x;
matrix.emplace(x, pair<long long int, long long int>(i, j));
}
long long int w = -1;
for(auto it = matrix.begin(); it != matrix.end(); it++) for(auto itt = matrix.begin(); itt != matrix.end(); itt++)
{
w = max(w, abs(it->first - itt->first) - abs(it->second.first - itt->second.first) - abs(it->second.second - itt->second.second) - 1);
}
cout << w << "\n";
return 0;
}
# | 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... |