Submission #1075923

# Submission time Handle Problem Language Result Execution time Memory
1075923 2024-08-26T09:49:17 Z TheQuantiX Wombats (IOI13_wombats) C++17
12 / 100
54 ms 10908 KB
#include <bits/stdc++.h>
#include "wombats.h"

using namespace std;
using ll = long long;

constexpr ll INF = 1000000000000000000LL;

ll n, m, q, k, x, y, a, b, c, l;
vector< vector<ll> > dp[100];
vector< vector<ll> > h;
vector< vector<ll> > v;

void make_dp(ll c) {
    dp[c].assign(n, vector<ll> (m, INF));
    dp[c][n - 1][c] = 0;
    for (int i = n - 1; i >= 0; i--) {
        if (i != n - 1) {
            for (int j = 0; j < m; j++) {
                dp[c][i][j] = min(dp[c][i][j], dp[c][i + 1][j] + v[i][j]);
            }
        }
        for (int j = 1; j < m; j++) {
            dp[c][i][j] = min(dp[c][i][j], dp[c][i][j - 1] + h[i][j - 1]);
        }
        for (int j = m - 2; j >= 0; j--) {
            dp[c][i][j] = min(dp[c][i][j], dp[c][i][j + 1] + h[i][j]);
        }
    }
}

void init(int R, int C, int H[5000][200], int V[5000][200]) {
    n = R;
    m = C;
    h.assign(n, vector<ll> (m - 1));
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < m - 1; j++) {
            h[i][j] = H[i][j];
        }
    }
    v.assign(n - 1, vector<ll> (m));
    for (int i = 0; i < n - 1; i++) {
        for (int j = 0; j < m; j++) {
            v[i][j] = V[i][j];
        }
    }
    for (int i = 0; i < C; i++) {
        make_dp(i);
    }
}

void changeH(int P, int Q, int W) {
    
}

void changeV(int P, int Q, int W) {

}

int escape(int V1, int V2) {
    return dp[V2][0][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 4 ms 5208 KB Output is correct
2 Incorrect 2 ms 5320 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 448 KB Output is correct
3 Correct 1 ms 344 KB Output is correct
4 Correct 1 ms 2396 KB Output is correct
5 Correct 1 ms 2396 KB Output is correct
6 Correct 1 ms 2396 KB Output is correct
7 Correct 1 ms 2396 KB Output is correct
8 Correct 1 ms 2396 KB Output is correct
9 Correct 1 ms 2396 KB Output is correct
10 Correct 1 ms 2396 KB Output is correct
11 Correct 54 ms 4948 KB Output is correct
12 Correct 1 ms 2396 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 8 ms 10844 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 9308 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 9 ms 10908 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 8 ms 10832 KB Output isn't correct
2 Halted 0 ms 0 KB -