답안 #71363

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
71363 2018-08-24T12:20:03 Z tamtam 웜뱃 (IOI13_wombats) C++14
16 / 100
20000 ms 26148 KB
#include "wombats.h"
#include <bits/stdc++.h>
#define F first
#define S seoncd
typedef long long ll;
using namespace std;

int r,c;
int h[5010][210];
int v[5010][210];
int dp[5010][110][3];
int en;

int Solve (int x,int y,int d){
    if (x==r-1&&y==en){
        return 0;
    }
    int &res=dp[x][y][d];
    if (res!=-1)return res;
    res=1000000000;
    if (y>0&&d!=2){
        res=min(res,Solve(x,y-1,1)+h[x][y-1]);
    }
    if (y<c-1&&d!=1){
        res=min(res,Solve(x,y+1,2)+h[x][y]);
    }
    if (x<r-1)
        res=min(res,Solve(x+1,y,0)+v[x][y]);
    return res;
}

void init(int R, int C, int H[5000][200], int V[5000][200]) {
    r=R;
    c=C;
    for (int i=0;i<r;i++){
        for (int l=0;l<c-1;l++){
            h[i][l]=H[i][l];
        }
    }
    for (int i=0;i<r-1;i++){
        for (int l=0;l<c;l++){
            v[i][l]=V[i][l];
        }
    }
}

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) {
    memset(dp,-1,sizeof dp);
    en=V2;
    return Solve(0,V1,0);
}
/*

3 4
0 2 5
7 1 1
0 4 0
0 0 0 2
0 3 4 7
5
3 2 1
3 3 3
2 0 0 5
1 1 1 6
3 2 1

*/

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 309 ms 15352 KB Output is correct
2 Correct 338 ms 15480 KB Output is correct
3 Execution timed out 20047 ms 16168 KB Time limit exceeded
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 8 ms 16168 KB Output is correct
2 Correct 7 ms 16168 KB Output is correct
3 Correct 10 ms 16168 KB Output is correct
4 Correct 180 ms 16168 KB Output is correct
5 Correct 196 ms 16168 KB Output is correct
6 Correct 189 ms 16168 KB Output is correct
7 Correct 236 ms 16168 KB Output is correct
8 Correct 170 ms 16168 KB Output is correct
9 Correct 165 ms 16168 KB Output is correct
10 Correct 149 ms 16168 KB Output is correct
11 Execution timed out 20025 ms 16168 KB Time limit exceeded
12 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 106 ms 16168 KB Output is correct
2 Correct 138 ms 16168 KB Output is correct
3 Correct 147 ms 16168 KB Output is correct
4 Correct 172 ms 16168 KB Output is correct
5 Correct 191 ms 16168 KB Output is correct
6 Correct 9 ms 16168 KB Output is correct
7 Correct 8 ms 16168 KB Output is correct
8 Correct 9 ms 16168 KB Output is correct
9 Correct 131 ms 16168 KB Output is correct
10 Correct 10 ms 16168 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1509 ms 24448 KB Output is correct
2 Correct 1736 ms 24508 KB Output is correct
3 Correct 1576 ms 24564 KB Output is correct
4 Execution timed out 20093 ms 25016 KB Time limit exceeded
# 결과 실행 시간 메모리 Grader output
1 Correct 157 ms 25016 KB Output is correct
2 Correct 122 ms 25016 KB Output is correct
3 Correct 149 ms 25016 KB Output is correct
4 Correct 176 ms 25016 KB Output is correct
5 Correct 200 ms 25016 KB Output is correct
6 Correct 1770 ms 25016 KB Output is correct
7 Correct 1392 ms 25048 KB Output is correct
8 Correct 1111 ms 25144 KB Output is correct
9 Execution timed out 20019 ms 25584 KB Time limit exceeded
10 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 114 ms 25584 KB Output is correct
2 Correct 141 ms 25584 KB Output is correct
3 Correct 117 ms 25584 KB Output is correct
4 Correct 108 ms 25584 KB Output is correct
5 Correct 129 ms 25584 KB Output is correct
6 Correct 1999 ms 25584 KB Output is correct
7 Correct 1611 ms 25584 KB Output is correct
8 Correct 1882 ms 25704 KB Output is correct
9 Execution timed out 20104 ms 26148 KB Time limit exceeded
10 Halted 0 ms 0 KB -