답안 #108571

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
108571 2019-04-30T08:53:59 Z tictaccat 웜뱃 (IOI13_wombats) C++14
28 / 100
20000 ms 17876 KB
#include "wombats.h"
#include <bits/stdc++.h>

using namespace std;

const int INF = 1e9;

int sum, R, C;
vector<vector<int>> H(5050,vector<int>(210,INF)), V(5050,vector<int>(210,INF)); 

void init(int Rt, int Ct, int tH[5000][200], int tV[5000][200]) {
    /* ... */
    R = Rt; C = Ct;
    for (int i = 0; i < 5000; i++) for (int j = 0; j < 200; j++) {H[i][j] = tH[i][j]; V[i][j] = tV[i][j];}
}

void changeH(int P, int Q, int W) {
    /* ... */
    H[P][Q] = W;
}

void changeV(int P, int Q, int W) {
    /* ... */
    V[P][Q] = W;
}

int escape(int V1, int V2) {
   // assert(V1 == 0 && V2 == 0);
    priority_queue<tuple<int,int,int>> pq;
    vector<vector<int>> dist(R,vector<int>(C,-1));

    pq.push(make_tuple(0,V1,0));

    while (!pq.empty()) {
        int c,r,d; tie(d,c,r) = pq.top(); pq.pop();
        if (dist[r][c] != -1) continue;
        d *= -1;
        dist[r][c] = d;
        if (c > 0) pq.push(make_tuple(-(d + H[r][c-1]),c-1,r));
        if (c < C-1) pq.push(make_tuple(-(d + H[r][c]),c+1,r));
        if (r < R-1) pq.push(make_tuple(-(d + V[r][c]),c,r+1));
    }

    return dist[R-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]
  int res;
      ^~~
# 결과 실행 시간 메모리 Grader output
1 Correct 193 ms 13332 KB Output is correct
2 Correct 230 ms 13388 KB Output is correct
3 Execution timed out 20057 ms 13888 KB Time limit exceeded
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 12 ms 8960 KB Output is correct
2 Correct 13 ms 8960 KB Output is correct
3 Correct 17 ms 8960 KB Output is correct
4 Correct 86 ms 9060 KB Output is correct
5 Correct 43 ms 8960 KB Output is correct
6 Correct 61 ms 9040 KB Output is correct
7 Correct 56 ms 8960 KB Output is correct
8 Correct 47 ms 9080 KB Output is correct
9 Correct 49 ms 8960 KB Output is correct
10 Correct 45 ms 9040 KB Output is correct
11 Correct 19405 ms 11692 KB Output is correct
12 Correct 65 ms 9080 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 301 ms 9216 KB Output is correct
2 Correct 449 ms 9672 KB Output is correct
3 Correct 340 ms 9216 KB Output is correct
4 Correct 308 ms 9336 KB Output is correct
5 Correct 329 ms 9336 KB Output is correct
6 Correct 12 ms 8960 KB Output is correct
7 Correct 13 ms 8960 KB Output is correct
8 Correct 14 ms 9040 KB Output is correct
9 Correct 377 ms 9336 KB Output is correct
10 Correct 16 ms 8960 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1726 ms 17428 KB Output is correct
2 Correct 2805 ms 17448 KB Output is correct
3 Correct 1827 ms 17504 KB Output is correct
4 Execution timed out 20079 ms 17872 KB Time limit exceeded
# 결과 실행 시간 메모리 Grader output
1 Correct 320 ms 9284 KB Output is correct
2 Correct 495 ms 9828 KB Output is correct
3 Correct 332 ms 9336 KB Output is correct
4 Correct 366 ms 9216 KB Output is correct
5 Correct 352 ms 9216 KB Output is correct
6 Correct 1511 ms 17408 KB Output is correct
7 Correct 2404 ms 17516 KB Output is correct
8 Correct 1217 ms 17396 KB Output is correct
9 Execution timed out 20016 ms 17768 KB Time limit exceeded
10 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 390 ms 9216 KB Output is correct
2 Correct 495 ms 9644 KB Output is correct
3 Correct 344 ms 9344 KB Output is correct
4 Correct 388 ms 9208 KB Output is correct
5 Correct 345 ms 9336 KB Output is correct
6 Correct 1594 ms 17568 KB Output is correct
7 Correct 2341 ms 17576 KB Output is correct
8 Correct 1260 ms 17488 KB Output is correct
9 Execution timed out 20028 ms 17876 KB Time limit exceeded
10 Halted 0 ms 0 KB -