Submission #84082

# Submission time Handle Problem Language Result Execution time Memory
84082 2018-11-12T20:01:06 Z alextodoran Maxcomp (info1cup18_maxcomp) C++14
60 / 100
500 ms 13388 KB
#include <bits/stdc++.h>

#define NM 1002

using namespace std;

int n, m;

int ma[NM][NM];

int mx = -1;

int dist(int a1, int a2, int b1, int b2)
{
    return abs(a1 - b1) + 1 + abs(a2 - b2) + 1 - 1;
}

int main()
{
    cin >> n >> m;
    for(int i = 1; i <= n; i++)
        for(int j = 1; j <= m; j++)
            cin >> ma[i][j];
    for(int i1 = 1; i1 <= n; i1++)
        for(int j1 = 1; j1 <= m; j1++)
            for(int i2 = 1; i2 <= n; i2++)
                for(int j2 = 1; j2 <= m; j2++)
                    if(abs(ma[i1][j1] - ma[i2][j2]) - dist(i1, j1, i2, j2) > mx)
                        mx = abs(ma[i1][j1] - ma[i2][j2]) - dist(i1, j1, i2, j2);
    cout << mx << "\n";
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 3 ms 372 KB Output is correct
3 Correct 3 ms 484 KB Output is correct
4 Correct 2 ms 504 KB Output is correct
5 Correct 2 ms 508 KB Output is correct
6 Correct 2 ms 604 KB Output is correct
7 Correct 2 ms 624 KB Output is correct
8 Correct 2 ms 648 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 652 KB Output is correct
2 Correct 4 ms 712 KB Output is correct
3 Correct 5 ms 848 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 3 ms 372 KB Output is correct
3 Correct 3 ms 484 KB Output is correct
4 Correct 2 ms 504 KB Output is correct
5 Correct 2 ms 508 KB Output is correct
6 Correct 2 ms 604 KB Output is correct
7 Correct 2 ms 624 KB Output is correct
8 Correct 2 ms 648 KB Output is correct
9 Correct 17 ms 1016 KB Output is correct
10 Correct 17 ms 1016 KB Output is correct
11 Correct 19 ms 1016 KB Output is correct
12 Correct 17 ms 1020 KB Output is correct
13 Correct 18 ms 1060 KB Output is correct
14 Correct 18 ms 1084 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 3 ms 372 KB Output is correct
3 Correct 3 ms 484 KB Output is correct
4 Correct 2 ms 504 KB Output is correct
5 Correct 2 ms 508 KB Output is correct
6 Correct 2 ms 604 KB Output is correct
7 Correct 2 ms 624 KB Output is correct
8 Correct 2 ms 648 KB Output is correct
9 Correct 4 ms 652 KB Output is correct
10 Correct 4 ms 712 KB Output is correct
11 Correct 5 ms 848 KB Output is correct
12 Correct 17 ms 1016 KB Output is correct
13 Correct 17 ms 1016 KB Output is correct
14 Correct 19 ms 1016 KB Output is correct
15 Correct 17 ms 1020 KB Output is correct
16 Correct 18 ms 1060 KB Output is correct
17 Correct 18 ms 1084 KB Output is correct
18 Execution timed out 1073 ms 13388 KB Time limit exceeded
19 Halted 0 ms 0 KB -