Submission #1068894

# Submission time Handle Problem Language Result Execution time Memory
1068894 2024-08-21T12:51:55 Z blackslex Wombats (IOI13_wombats) C++17
0 / 100
20000 ms 18776 KB
#include "wombats.h"
#include<bits/stdc++.h>

using namespace std;
using pii = pair<int, int>;

const int N = 405;
int n, m, d[N][N], d2[N][N];

int get (int x, int y) {
    return x * m + y;
}

void init(int R, int C, int H[5000][200], int V[5000][200]) {
    n = R; m = C;
    for (int i = 0; i < n * m; i++) {
        for (int j = 0; j < n * m; j++) d[i][j] = 1e9;
    }
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < m - 1; j++) {
            d[get(i, j)][get(i, j + 1)] = d[get(i, j + 1)][get(i, j)] = H[i][j];
        }
    }
    for (int i = 0; i < n - 1; i++) {
        for (int j = 0; j < m; j++) {
            d[get(i, j)][get(i + 1, j)] = V[i][j];
        }
    }
}

void changeH(int P, int Q, int W) {
    d[get(P, Q)][get(P, Q + 1)] = d[get(P, Q + 1)][get(P, Q)] = W;
}

void changeV(int P, int Q, int W) {
    d[get(P, Q)][get(P + 1, Q)] = W;
}

int escape(int V1, int V2) {
    for (int i = 0; i < n * m; i++) {
        for (int j = 0; j < n * m; j++) d2[i][j] = d[i][j];
    }
    for (int k = 0; k < n * m; k++) {
        for (int i = 0; i < n * m; i++) {
            for (int j = 0; j < n * m; j++) d2[i][j] = min(d2[i][j], d2[i][k] + d2[k][j]);
        }
    }
    return d2[get(0, V1)][get(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;
      |      ^~~
# Verdict Execution time Memory Grader output
1 Runtime error 6 ms 10332 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 2396 KB Output is correct
2 Correct 0 ms 2396 KB Output is correct
3 Correct 1 ms 2396 KB Output is correct
4 Execution timed out 20086 ms 5212 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 7 ms 6232 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 12 ms 18776 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 6 ms 6236 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 5 ms 6160 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -