답안 #1068909

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1068909 2024-08-21T13:05:57 Z blackslex 웜뱃 (IOI13_wombats) C++17
28 / 100
4779 ms 16988 KB
#include "wombats.h"
#include<bits/stdc++.h>

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

const int N = 105;
int n, m, ch[N][N], cv[N][N];
vector<pii> v[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; i++) {
        for (int j = 0; j < m - 1; j++) {
            ch[i][j] = H[i][j];
            v[get(i, j)].emplace_back(get(i, j + 1), H[i][j]);
            v[get(i, j + 1)].emplace_back(get(i, j), H[i][j]);
        }
    }
    for (int i = 0; i < n - 1; i++) {
        for (int j = 0; j < m; j++) {
            cv[i][j] = V[i][j];
            v[get(i, j)].emplace_back(get(i + 1, j), V[i][j]);
        }
    }
}

void changeH(int P, int Q, int W) {
    int st = get(P, Q), ed = get(P, Q + 1);
    v[st].erase(find(v[st].begin(), v[st].end(), pii(ed, ch[P][Q])));
    v[ed].erase(find(v[ed].begin(), v[ed].end(), pii(st, ch[P][Q])));
    ch[P][Q] = W;
    v[st].emplace_back(ed, W);
    v[ed].emplace_back(st, W);
}

void changeV(int P, int Q, int W) {
    int st = get(P, Q), ed = get(P + 1, Q);
    v[st].erase(find(v[st].begin(), v[st].end(), pii(ed, cv[P][Q])));
    cv[P][Q] = W;
    v[st].emplace_back(ed, W);
}

int escape(int V1, int V2) {
    priority_queue<pii, vector<pii>, greater<pii>> pq;
    vector<int> d(n * m + 5, 1e9);
    int st = get(0, V1), ed = get(n - 1, V2);
    pq.emplace(d[st] = 0, st);
    while (!pq.empty()) {
        auto [nd, nn] = pq.top(); pq.pop();
        for (auto &[tn, td]: v[nn]) {
            if (d[tn] > d[nn] + td) pq.emplace(d[tn] = d[nn] + td, tn);
        }
    }
    return d[ed];
}

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;
      |      ^~~
# 결과 실행 시간 메모리 Grader output
1 Runtime error 5 ms 9816 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 604 KB Output is correct
2 Correct 0 ms 604 KB Output is correct
3 Correct 0 ms 604 KB Output is correct
4 Correct 10 ms 2652 KB Output is correct
5 Correct 4 ms 2816 KB Output is correct
6 Correct 4 ms 2816 KB Output is correct
7 Correct 9 ms 2652 KB Output is correct
8 Correct 9 ms 2652 KB Output is correct
9 Correct 10 ms 2648 KB Output is correct
10 Correct 9 ms 2652 KB Output is correct
11 Correct 4779 ms 3736 KB Output is correct
12 Correct 12 ms 2648 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 97 ms 3416 KB Output is correct
2 Correct 151 ms 3592 KB Output is correct
3 Correct 98 ms 3420 KB Output is correct
4 Correct 98 ms 3420 KB Output is correct
5 Correct 97 ms 3420 KB Output is correct
6 Correct 1 ms 600 KB Output is correct
7 Correct 1 ms 600 KB Output is correct
8 Correct 0 ms 604 KB Output is correct
9 Correct 144 ms 3520 KB Output is correct
10 Correct 1 ms 2652 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Runtime error 8 ms 16984 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 96 ms 3420 KB Output is correct
2 Correct 154 ms 3592 KB Output is correct
3 Correct 99 ms 3416 KB Output is correct
4 Correct 102 ms 3508 KB Output is correct
5 Correct 97 ms 3416 KB Output is correct
6 Runtime error 9 ms 16988 KB Execution killed with signal 11
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 102 ms 3416 KB Output is correct
2 Correct 150 ms 3588 KB Output is correct
3 Correct 100 ms 3504 KB Output is correct
4 Correct 98 ms 3416 KB Output is correct
5 Correct 102 ms 3416 KB Output is correct
6 Runtime error 8 ms 16988 KB Execution killed with signal 11
7 Halted 0 ms 0 KB -