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>
int main()
{
int n, m;
std::cin >> n >> m;
std::vector<int> A[n];
for (int i = 0; i < n; ++i)
for (int j = 0; j < m; ++j)
{
int k;
std::cin >> k;
A[i].push_back(k);
}
int S = -1;
for (int i = 0; i < n; ++i)
{
for (int j = 0; j < m; ++j)
{
for (int k = 0; k < n; ++k)
{
for (int w = 0; w < m; ++w)
{
//std::cout << std::max(A[i][j], A[k][w])-std::min(A[i][j], A[k][w])-(std::abs(i-k)+std::abs(j-w)+1) << " ";
S = std::max(S, std::max(A[i][j], A[k][w])-std::min(A[i][j], A[k][w])-(std::abs(i-k)+std::abs(j-w)+1));
}
}
}
}
std::cout << "\n" << S << "\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... |