Submission #1074038

# Submission time Handle Problem Language Result Execution time Memory
1074038 2024-08-25T07:02:43 Z Ignut Wombats (IOI13_wombats) C++17
55 / 100
20000 ms 33392 KB
// Ignut

#include <bits/stdc++.h>
#include "wombats.h"

using namespace std;
using ll = long long;

// const int H = 5555, W = 222;
int h, w;

vector<vector<int>> dwn, rht;
vector<vector<int>> pref;

void init(int R, int C, int H[5000][200], int V[5000][200]) {
    h = R, w = C;
    dwn.assign(h, {});
    rht.assign(h, {});
    pref.assign(h, {});

    for (int i = 0; i < h - 1; i ++)
        for (int j = 0; j < w; j ++)
            dwn[i].push_back(V[i][j]);
    
    for (int i = 0; i < h; i ++) {
        pref[i].push_back(0);
        for (int j = 0; j < w - 1; j ++) {
            rht[i].push_back(H[i][j]);
            pref[i].push_back(pref[i].back() + H[i][j]);
        }
    }
}

void changeH(int P, int Q, int W) {
    rht[P][Q] = W;
    pref[P] = {0};
    for (int j = 0; j < w - 1; j ++)
        pref[P].push_back(pref[P].back() + rht[P][j]);
}

void changeV(int P, int Q, int W) {
    dwn[P][Q] = W;
}

const int INF = 1e9 + 123;

int escape(int V1, int V2) {
    vector<int> dist(w, INF);
    dist[V1] = 0;
    for (int i = 0; i < h; i ++) {
        for (int j1 = 0; j1 < w; j1 ++) {
            for (int j2 = 0; j2 < w; j2 ++) {
                dist[j1] = min(dist[j1], dist[j2] + abs(pref[i][j1] - pref[i][j2]));
            }
        }
        if (i + 1 < h)
            for (int j = 0; j < w; j ++)
                dist[j] += dwn[i][j];
    }
    return dist[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;
      |      ^~~
# Verdict Execution time Memory Grader output
1 Correct 8 ms 4952 KB Output is correct
2 Correct 8 ms 4956 KB Output is correct
3 Correct 2423 ms 6556 KB Output is correct
4 Correct 8 ms 4956 KB Output is correct
5 Correct 8 ms 4956 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 4 ms 2396 KB Output is correct
5 Correct 4 ms 2512 KB Output is correct
6 Correct 4 ms 2396 KB Output is correct
7 Correct 4 ms 2516 KB Output is correct
8 Correct 3 ms 2396 KB Output is correct
9 Correct 4 ms 2396 KB Output is correct
10 Correct 4 ms 2520 KB Output is correct
11 Correct 1799 ms 3580 KB Output is correct
12 Correct 4 ms 2396 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 106 ms 2708 KB Output is correct
2 Correct 103 ms 2652 KB Output is correct
3 Correct 108 ms 2652 KB Output is correct
4 Correct 106 ms 2648 KB Output is correct
5 Correct 106 ms 2652 KB Output is correct
6 Correct 0 ms 344 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 120 ms 2652 KB Output is correct
10 Correct 0 ms 2392 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 61 ms 9068 KB Output is correct
2 Correct 61 ms 9052 KB Output is correct
3 Correct 61 ms 9048 KB Output is correct
4 Correct 5675 ms 10368 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 112 ms 2648 KB Output is correct
2 Correct 103 ms 2780 KB Output is correct
3 Correct 107 ms 2648 KB Output is correct
4 Correct 109 ms 2652 KB Output is correct
5 Correct 110 ms 2796 KB Output is correct
6 Correct 61 ms 9052 KB Output is correct
7 Correct 61 ms 9052 KB Output is correct
8 Correct 61 ms 9048 KB Output is correct
9 Correct 5612 ms 10372 KB Output is correct
10 Correct 8 ms 4956 KB Output is correct
11 Correct 8 ms 4956 KB Output is correct
12 Correct 2612 ms 7584 KB Output is correct
13 Correct 8 ms 4956 KB Output is correct
14 Correct 8 ms 5012 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 5 ms 2396 KB Output is correct
19 Correct 4 ms 2524 KB Output is correct
20 Correct 4 ms 2396 KB Output is correct
21 Correct 4 ms 2396 KB Output is correct
22 Correct 3 ms 2396 KB Output is correct
23 Correct 4 ms 2396 KB Output is correct
24 Correct 3 ms 2396 KB Output is correct
25 Correct 1784 ms 4672 KB Output is correct
26 Correct 4 ms 2396 KB Output is correct
27 Correct 107 ms 2756 KB Output is correct
28 Execution timed out 20066 ms 19796 KB Time limit exceeded
29 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 111 ms 2708 KB Output is correct
2 Correct 104 ms 2652 KB Output is correct
3 Correct 106 ms 2648 KB Output is correct
4 Correct 118 ms 2792 KB Output is correct
5 Correct 105 ms 2792 KB Output is correct
6 Correct 61 ms 9052 KB Output is correct
7 Correct 61 ms 9304 KB Output is correct
8 Correct 61 ms 9048 KB Output is correct
9 Correct 5602 ms 10396 KB Output is correct
10 Correct 8 ms 4956 KB Output is correct
11 Correct 9 ms 4804 KB Output is correct
12 Correct 2456 ms 7696 KB Output is correct
13 Correct 8 ms 4952 KB Output is correct
14 Correct 8 ms 4956 KB Output is correct
15 Correct 1428 ms 33392 KB Output is correct
16 Execution timed out 20060 ms 31572 KB Time limit exceeded
17 Halted 0 ms 0 KB -