Submission #96449

# Submission time Handle Problem Language Result Execution time Memory
96449 2019-02-09T13:43:17 Z ASG1065 Maxcomp (info1cup18_maxcomp) C++14
60 / 100
500 ms 4456 KB
#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
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2 ms 256 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
8 Correct 2 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 256 KB Output is correct
2 Correct 6 ms 376 KB Output is correct
3 Correct 5 ms 452 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2 ms 256 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
8 Correct 2 ms 376 KB Output is correct
9 Correct 27 ms 376 KB Output is correct
10 Correct 32 ms 256 KB Output is correct
11 Correct 22 ms 256 KB Output is correct
12 Correct 21 ms 256 KB Output is correct
13 Correct 22 ms 256 KB Output is correct
14 Correct 27 ms 256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2 ms 256 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
8 Correct 2 ms 376 KB Output is correct
9 Correct 6 ms 256 KB Output is correct
10 Correct 6 ms 376 KB Output is correct
11 Correct 5 ms 452 KB Output is correct
12 Correct 27 ms 376 KB Output is correct
13 Correct 32 ms 256 KB Output is correct
14 Correct 22 ms 256 KB Output is correct
15 Correct 21 ms 256 KB Output is correct
16 Correct 22 ms 256 KB Output is correct
17 Correct 27 ms 256 KB Output is correct
18 Execution timed out 1062 ms 4456 KB Time limit exceeded
19 Halted 0 ms 0 KB -