Submission #298638

# Submission time Handle Problem Language Result Execution time Memory
298638 2020-09-13T16:52:07 Z emil_physmath Wombats (IOI13_wombats) C++17
55 / 100
20000 ms 215544 KB
#include "wombats.h"
#include <bits/stdc++.h>
using namespace std;
const int maxN = 5000;
const int maxM = 100;

int n, m;
int h[5000][200], v[5000][200];
int dp[maxM][maxN][maxM];

void Mini(auto& l, auto r) { l = min(l, r); }
void Build()
{
    for (int s = 0; s < m; ++s)
    {
        int (*dp)[maxM] = ::dp[s];
        dp[0][s] = 0;
        for (int j = s + 1; j < m; ++j)
            dp[0][j] = dp[0][j - 1] + h[0][j - 1];
        for (int j = s - 1; j >= 0; --j)
            dp[0][j] = dp[0][j + 1] + h[0][j];
        for (int i = 1; i < n; ++i)
        {
            for (int j = 0; j < m; ++j)
                dp[i][j] = dp[i - 1][j] + v[i - 1][j];
            for (int j = 1; j < m; ++j)
                Mini(dp[i][j], dp[i][j - 1] + h[i][j - 1]);
            for (int j = m - 2; j >= 0; --j)
                Mini(dp[i][j], dp[i][j + 1] + h[i][j]);
        }
    }
}

void init(int R, int C, int H[5000][200], int V[5000][200]) {
    if (C <= 2);
    else if (min(R, C) <= 100);
    else exit(0);
    n = R, m = C;
    for (int i = 0; i < 5000; ++i)
        for (int j = 0; j < 200; ++j)
            h[i][j] = H[i][j], v[i][j] = V[i][j];
    Build();
}

void changeH(int x, int y, int w) {
    h[x][y] = w;
    Build();
}

void changeV(int x, int y, int w) {
    v[x][y] = w;
    Build();
}

int escape(int v1, int v2) {
    return dp[v1][n - 1][v2];
}

Compilation message

grader.c: In function 'int main()':
grader.c:15:6: warning: variable 'res' set but not used [-Wunused-but-set-variable]
   15 |  int res;
      |      ^~~
wombats.cpp:11:11: warning: use of 'auto' in parameter declaration only available with '-fconcepts'
   11 | void Mini(auto& l, auto r) { l = min(l, r); }
      |           ^~~~
wombats.cpp:11:20: warning: use of 'auto' in parameter declaration only available with '-fconcepts'
   11 | void Mini(auto& l, auto r) { l = min(l, r); }
      |                    ^~~~
# Verdict Execution time Memory Grader output
1 Correct 26 ms 13984 KB Output is correct
2 Correct 27 ms 14080 KB Output is correct
3 Correct 115 ms 16888 KB Output is correct
4 Correct 26 ms 14080 KB Output is correct
5 Correct 31 ms 14080 KB Output is correct
6 Correct 7 ms 8224 KB Output is correct
7 Correct 7 ms 8192 KB Output is correct
8 Correct 7 ms 8192 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 7 ms 8192 KB Output is correct
2 Correct 7 ms 8192 KB Output is correct
3 Correct 7 ms 8192 KB Output is correct
4 Correct 7 ms 8448 KB Output is correct
5 Correct 7 ms 8448 KB Output is correct
6 Correct 7 ms 8448 KB Output is correct
7 Correct 8 ms 8448 KB Output is correct
8 Correct 7 ms 8576 KB Output is correct
9 Correct 7 ms 8448 KB Output is correct
10 Correct 8 ms 8448 KB Output is correct
11 Correct 97 ms 10872 KB Output is correct
12 Correct 7 ms 8448 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 911 ms 13240 KB Output is correct
2 Correct 892 ms 13048 KB Output is correct
3 Correct 932 ms 13176 KB Output is correct
4 Correct 916 ms 13308 KB Output is correct
5 Correct 917 ms 13304 KB Output is correct
6 Correct 7 ms 8320 KB Output is correct
7 Correct 7 ms 8192 KB Output is correct
8 Correct 7 ms 8192 KB Output is correct
9 Correct 4552 ms 13124 KB Output is correct
10 Correct 7 ms 8192 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 93 ms 19968 KB Output is correct
2 Correct 91 ms 20096 KB Output is correct
3 Correct 92 ms 19968 KB Output is correct
4 Correct 138 ms 21368 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 919 ms 13092 KB Output is correct
2 Correct 902 ms 13048 KB Output is correct
3 Correct 927 ms 13132 KB Output is correct
4 Correct 948 ms 13176 KB Output is correct
5 Correct 903 ms 13176 KB Output is correct
6 Correct 97 ms 20088 KB Output is correct
7 Correct 97 ms 19968 KB Output is correct
8 Correct 95 ms 19968 KB Output is correct
9 Correct 138 ms 21368 KB Output is correct
10 Correct 28 ms 14080 KB Output is correct
11 Correct 27 ms 14080 KB Output is correct
12 Correct 114 ms 16888 KB Output is correct
13 Correct 29 ms 14080 KB Output is correct
14 Correct 28 ms 14080 KB Output is correct
15 Correct 7 ms 8192 KB Output is correct
16 Correct 7 ms 8192 KB Output is correct
17 Correct 7 ms 8192 KB Output is correct
18 Correct 7 ms 8448 KB Output is correct
19 Correct 7 ms 8448 KB Output is correct
20 Correct 8 ms 8448 KB Output is correct
21 Correct 7 ms 8448 KB Output is correct
22 Correct 7 ms 8448 KB Output is correct
23 Correct 7 ms 8448 KB Output is correct
24 Correct 7 ms 8448 KB Output is correct
25 Correct 101 ms 10872 KB Output is correct
26 Correct 7 ms 8448 KB Output is correct
27 Correct 4514 ms 13128 KB Output is correct
28 Execution timed out 20071 ms 215544 KB Time limit exceeded
29 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 912 ms 13056 KB Output is correct
2 Correct 893 ms 12928 KB Output is correct
3 Correct 928 ms 13124 KB Output is correct
4 Correct 931 ms 13124 KB Output is correct
5 Correct 900 ms 13176 KB Output is correct
6 Correct 95 ms 19968 KB Output is correct
7 Correct 96 ms 19968 KB Output is correct
8 Correct 96 ms 19968 KB Output is correct
9 Correct 137 ms 21496 KB Output is correct
10 Correct 27 ms 14080 KB Output is correct
11 Correct 29 ms 14080 KB Output is correct
12 Correct 123 ms 16888 KB Output is correct
13 Correct 28 ms 14080 KB Output is correct
14 Correct 28 ms 14080 KB Output is correct
15 Incorrect 269 ms 17916 KB Output isn't correct
16 Halted 0 ms 0 KB -