이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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... |