답안 #64739

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
64739 2018-08-05T13:36:09 Z mhnd 웜뱃 (IOI13_wombats) C++14
21 / 100
20000 ms 24460 KB
#include "wombats.h"
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
const int N = 1e5+50;
const ll oo = 1e18;
const ll mod = 1e9+7;

int dp[201][5001][201],h[5010][210],v[5010][210],c,r;

void build(){
	for(int x = 0;x<c;x++){
		for(int i=0;i<c;i++)dp[x][r-1][i]=1e9;
		dp[x][r-1][x]=0;
	    for(int i=r-2;i>=0;i--)
	    	for(int j=0;j<c;j++)
	    		dp[x][i][j] = dp[x][i+1][j] + v[i][j];
	    for(int w = 0;w<500;w++){
			for(int i=r-1;i>=0;i--){
			    for(int j=0;j<c;j++){
			    	if(i!=r-1)dp[x][i][j] = min(dp[x][i][j],dp[x][i+1][j]+v[i][j]);
			    	if(j)dp[x][i][j] = min(dp[x][i][j],dp[x][i][j-1] + h[i][j-1]);
			    	if(j < c-1)dp[x][i][j] = min(dp[x][i][j],dp[x][i][j+1]+h[i][j]);
			    }
			}
		}
	}
}

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

void changeH(int P, int Q, int W) {
	h[P][Q]=W;
	build();
}

void changeV(int P, int Q, int W) {
	v[P][Q]=W;
	build();
}

int escape(int V1, int V2) {
	if(dp[V2][0][V1] == 1e9)return 0;
    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]
  int res;
      ^~~
# 결과 실행 시간 메모리 Grader output
1 Correct 13780 ms 16504 KB Output is correct
2 Correct 13360 ms 16504 KB Output is correct
3 Correct 12679 ms 18112 KB Output is correct
4 Correct 13117 ms 18112 KB Output is correct
5 Correct 12900 ms 18112 KB Output is correct
6 Correct 11 ms 18112 KB Output is correct
7 Correct 13 ms 18112 KB Output is correct
8 Correct 12 ms 18112 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 13 ms 18112 KB Output is correct
2 Correct 14 ms 18112 KB Output is correct
3 Correct 15 ms 18112 KB Output is correct
4 Correct 44 ms 18112 KB Output is correct
5 Correct 36 ms 18112 KB Output is correct
6 Correct 44 ms 18112 KB Output is correct
7 Correct 39 ms 18112 KB Output is correct
8 Correct 33 ms 18112 KB Output is correct
9 Correct 41 ms 18112 KB Output is correct
10 Correct 33 ms 18112 KB Output is correct
11 Correct 125 ms 18112 KB Output is correct
12 Correct 42 ms 18112 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 20093 ms 18112 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 20020 ms 24460 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 20015 ms 24460 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 20104 ms 24460 KB Time limit exceeded
2 Halted 0 ms 0 KB -