Submission #96449

#TimeUsernameProblemLanguageResultExecution timeMemory
96449ASG1065Maxcomp (info1cup18_maxcomp)C++14
60 / 100
1062 ms4456 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...