Submission #786553

# Submission time Handle Problem Language Result Execution time Memory
786553 2023-07-18T09:08:35 Z drdilyor Wombats (IOI13_wombats) C++17
55 / 100
20000 ms 26080 KB
#include<bits/stdc++.h>
#include "wombats.h"
using namespace std;
const int inf = 1e9;
using ll = long long;
constexpr ll infl = 1e18;

int sum = 0;
int r, c;
vector<vector<int>> level;
vector<vector<int>> pass;

void init(int r, int c, int h[5000][200], int v[5000][200]) {
    ::r = r;
    ::c = c;
    level.resize(r);
    for (int i = 0; i < r; i++) {
        level[i].resize(c-1);
        for (int j = 0; j < c-1; j++) {
            level[i][j] = h[i][j];
        }
    }

    pass.resize(r-1);
    for (int i = 0; i < r-1; i++) {
        pass[i].resize(c);
        for (int j = 0; j < c; j++) {
            pass[i][j] = v[i][j];
        }
    }
}

void changeH(int p, int q, int w) {
    level[p][q] = w;
}

void changeV(int p, int q, int w) {
    pass[p][q] = w;
}

int escape(int v1, int v2) {
    vector<ll> dp(c, infl);
    dp[v2] = 0;
    for (int i = r-1; i >= 0; i--) {
        vector<ll> ndp(c, infl);
        for (int j = 0; j < c; j++) {
            for (ll k = j - 1, sum = 0; k >= 0; k--) {
                sum += level[i][k];
                ndp[j] = min(ndp[j], dp[k] + sum);
            }
            for (ll k = j, sum = 0; k < c; k++) {
                ndp[j] = min(ndp[j], dp[k] + sum);
                if (k < c-1) sum += level[i][k];
            }
            if (i) ndp[j] += pass[i-1][j];
        }
        dp.swap(ndp);
    }
    return dp[v1];
}

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;
      |      ^~~
# Verdict Execution time Memory Grader output
1 Correct 35 ms 4564 KB Output is correct
2 Correct 35 ms 4564 KB Output is correct
3 Correct 13066 ms 6472 KB Output is correct
4 Correct 35 ms 4564 KB Output is correct
5 Correct 34 ms 4564 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 308 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 5 ms 312 KB Output is correct
5 Correct 4 ms 340 KB Output is correct
6 Correct 4 ms 340 KB Output is correct
7 Correct 4 ms 340 KB Output is correct
8 Correct 3 ms 340 KB Output is correct
9 Correct 4 ms 340 KB Output is correct
10 Correct 4 ms 340 KB Output is correct
11 Correct 1873 ms 1968 KB Output is correct
12 Correct 4 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 121 ms 620 KB Output is correct
2 Correct 110 ms 596 KB Output is correct
3 Correct 118 ms 620 KB Output is correct
4 Correct 113 ms 624 KB Output is correct
5 Correct 119 ms 624 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 312 KB Output is correct
9 Correct 120 ms 616 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 96 ms 8732 KB Output is correct
2 Correct 113 ms 8720 KB Output is correct
3 Correct 98 ms 8728 KB Output is correct
4 Correct 8990 ms 10060 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 111 ms 544 KB Output is correct
2 Correct 110 ms 608 KB Output is correct
3 Correct 119 ms 620 KB Output is correct
4 Correct 113 ms 596 KB Output is correct
5 Correct 111 ms 616 KB Output is correct
6 Correct 116 ms 8732 KB Output is correct
7 Correct 92 ms 8660 KB Output is correct
8 Correct 94 ms 8736 KB Output is correct
9 Correct 8894 ms 10084 KB Output is correct
10 Correct 40 ms 4564 KB Output is correct
11 Correct 39 ms 4620 KB Output is correct
12 Correct 13437 ms 7404 KB Output is correct
13 Correct 35 ms 4632 KB Output is correct
14 Correct 35 ms 4564 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 1 ms 308 KB Output is correct
17 Correct 1 ms 340 KB Output is correct
18 Correct 5 ms 312 KB Output is correct
19 Correct 4 ms 340 KB Output is correct
20 Correct 4 ms 340 KB Output is correct
21 Correct 4 ms 340 KB Output is correct
22 Correct 3 ms 352 KB Output is correct
23 Correct 4 ms 340 KB Output is correct
24 Correct 4 ms 340 KB Output is correct
25 Correct 1806 ms 2712 KB Output is correct
26 Correct 4 ms 340 KB Output is correct
27 Correct 112 ms 624 KB Output is correct
28 Execution timed out 20079 ms 15916 KB Time limit exceeded
29 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 128 ms 620 KB Output is correct
2 Correct 110 ms 604 KB Output is correct
3 Correct 113 ms 620 KB Output is correct
4 Correct 112 ms 620 KB Output is correct
5 Correct 114 ms 620 KB Output is correct
6 Correct 98 ms 8732 KB Output is correct
7 Correct 91 ms 8644 KB Output is correct
8 Correct 92 ms 8724 KB Output is correct
9 Correct 9048 ms 10092 KB Output is correct
10 Correct 35 ms 4564 KB Output is correct
11 Correct 34 ms 4620 KB Output is correct
12 Correct 13053 ms 7404 KB Output is correct
13 Correct 43 ms 4564 KB Output is correct
14 Correct 35 ms 4624 KB Output is correct
15 Correct 1466 ms 26080 KB Output is correct
16 Execution timed out 20043 ms 24148 KB Time limit exceeded
17 Halted 0 ms 0 KB -