답안 #38361

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
38361 2018-01-04T04:18:14 Z funcsr 웜뱃 (IOI13_wombats) C++14
55 / 100
7956 ms 17800 KB
#include "wombats.h"
#include <iostream>
#include <vector>
#include <set>
#include <queue>
#include <string>
#define rep(i, n) for (int i=0; i<(n); i++)
#define pb push_back
#define INF 1145141919
#define _1 first
#define _2 second
using namespace std;
const int B = 1000;
int W, H;
int yoko[200][5000];
int tate[200][5000];
int dp[200][200];

void update() {
  rep(src, W) {
    rep(x, W) dp[src][x] = INF;
    dp[src][src] = 0;
    rep(x, W-1) dp[src][x+1] = min(dp[src][x+1], dp[src][x]+yoko[x][0]);
    for (int x=W-1; x>0; x--) dp[src][x-1] = min(dp[src][x-1], dp[src][x]+yoko[x-1][0]);

    rep(y, H-1) {
      rep(x, W) dp[src][x] += tate[x][y];
      rep(x, W-1) dp[src][x+1] = min(dp[src][x+1], dp[src][x]+yoko[x][y+1]);
      for (int x=W-1; x>0; x--) dp[src][x-1] = min(dp[src][x-1], dp[src][x]+yoko[x-1][y+1]);
    }
  }
}
void init(int R, int C, int _yoko[5000][200], int _tate[5000][200]) {
  W = C, H = R;
  rep(y, H) rep(x, W-1) yoko[x][y] = _yoko[y][x];
  rep(x, W) rep(y, H-1) tate[x][y] = _tate[y][x];
  update();
}

void changeH(int P, int Q, int W) {
  yoko[Q][P] = W;
  update();
}

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

int escape(int V1, int V2) {
  return dp[V1][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 6 ms 17800 KB Output is correct
2 Correct 9 ms 17800 KB Output is correct
3 Correct 133 ms 17800 KB Output is correct
4 Correct 9 ms 17800 KB Output is correct
5 Correct 6 ms 17800 KB Output is correct
6 Correct 0 ms 17800 KB Output is correct
7 Correct 0 ms 17800 KB Output is correct
8 Correct 0 ms 17800 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 17800 KB Output is correct
2 Correct 0 ms 17800 KB Output is correct
3 Correct 0 ms 17800 KB Output is correct
4 Correct 0 ms 17800 KB Output is correct
5 Correct 0 ms 17800 KB Output is correct
6 Correct 0 ms 17800 KB Output is correct
7 Correct 0 ms 17800 KB Output is correct
8 Correct 0 ms 17800 KB Output is correct
9 Correct 0 ms 17800 KB Output is correct
10 Correct 0 ms 17800 KB Output is correct
11 Correct 106 ms 17800 KB Output is correct
12 Correct 0 ms 17800 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 459 ms 17800 KB Output is correct
2 Correct 473 ms 17800 KB Output is correct
3 Correct 429 ms 17800 KB Output is correct
4 Correct 466 ms 17800 KB Output is correct
5 Correct 463 ms 17800 KB Output is correct
6 Correct 0 ms 17800 KB Output is correct
7 Correct 0 ms 17800 KB Output is correct
8 Correct 0 ms 17800 KB Output is correct
9 Correct 2363 ms 17800 KB Output is correct
10 Correct 0 ms 17800 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 63 ms 17800 KB Output is correct
2 Correct 53 ms 17800 KB Output is correct
3 Correct 63 ms 17800 KB Output is correct
4 Correct 109 ms 17800 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 463 ms 17800 KB Output is correct
2 Correct 469 ms 17800 KB Output is correct
3 Correct 479 ms 17800 KB Output is correct
4 Correct 533 ms 17800 KB Output is correct
5 Correct 479 ms 17800 KB Output is correct
6 Correct 56 ms 17800 KB Output is correct
7 Correct 59 ms 17800 KB Output is correct
8 Correct 53 ms 17800 KB Output is correct
9 Correct 143 ms 17800 KB Output is correct
10 Correct 9 ms 17800 KB Output is correct
11 Correct 6 ms 17800 KB Output is correct
12 Correct 109 ms 17800 KB Output is correct
13 Correct 9 ms 17800 KB Output is correct
14 Correct 6 ms 17800 KB Output is correct
15 Correct 0 ms 17800 KB Output is correct
16 Correct 0 ms 17800 KB Output is correct
17 Correct 0 ms 17800 KB Output is correct
18 Correct 0 ms 17800 KB Output is correct
19 Correct 0 ms 17800 KB Output is correct
20 Correct 0 ms 17800 KB Output is correct
21 Correct 0 ms 17800 KB Output is correct
22 Correct 0 ms 17800 KB Output is correct
23 Correct 0 ms 17800 KB Output is correct
24 Correct 0 ms 17800 KB Output is correct
25 Correct 96 ms 17800 KB Output is correct
26 Correct 0 ms 17800 KB Output is correct
27 Correct 2289 ms 17800 KB Output is correct
28 Runtime error 0 ms 0 KB -1: Interrupted system call
29 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 443 ms 17800 KB Output is correct
2 Correct 443 ms 17800 KB Output is correct
3 Correct 476 ms 17800 KB Output is correct
4 Correct 469 ms 17800 KB Output is correct
5 Correct 469 ms 17800 KB Output is correct
6 Correct 66 ms 17800 KB Output is correct
7 Correct 49 ms 17800 KB Output is correct
8 Correct 59 ms 17800 KB Output is correct
9 Correct 123 ms 17800 KB Output is correct
10 Correct 3 ms 17800 KB Output is correct
11 Correct 6 ms 17800 KB Output is correct
12 Correct 76 ms 17800 KB Output is correct
13 Correct 6 ms 17800 KB Output is correct
14 Correct 6 ms 17800 KB Output is correct
15 Correct 7956 ms 17800 KB Output is correct
16 Runtime error 0 ms 0 KB -1: Interrupted system call
17 Halted 0 ms 0 KB -