답안 #359454

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
359454 2021-01-27T03:07:49 Z tengiz05 웜뱃 (IOI13_wombats) C++17
55 / 100
20000 ms 16940 KB
#include "wombats.h"
#ifndef EVAL
#include "grader.c"
#endif
#include <bits/stdc++.h>
using namespace std;
int n, m;
int h[5000][200], v[5000][200];
int dp[200][200], old[200][200];
void recalc(){
	for(int start = 0; start < m; start++){
		int carry = 0;
		for(int i=start;i<m;i++){
			dp[start][i] = carry;
			carry += h[0][i];
		}carry = 0;
		for(int i=start-1;i>=0;i--){
			carry += h[0][i];
			dp[start][i] = carry;
		}
		for(int row=1;row<n;row++){
			swap(dp[start],old[start]);
			for(int i=0;i<m;i++){
				dp[start][i] = old[start][i] + v[row-1][i];
			}
			for(int i=1;i<m;i++){
				dp[start][i] = min(dp[start][i], dp[start][i-1] + h[row][i-1]);
			}
			for(int i=m-2;i>=0;i--){
				dp[start][i] = min(dp[start][i], dp[start][i+1] + h[row][i]);
			}
		}
	}
}
void init(int R, int C, int H[5000][200], int V[5000][200]){
	n = R, m = 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];
		}
	}recalc();
}

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

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

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]
   15 |  int res;
      |      ^~~
# 결과 실행 시간 메모리 Grader output
1 Correct 539 ms 12136 KB Output is correct
2 Correct 564 ms 12140 KB Output is correct
3 Correct 623 ms 13676 KB Output is correct
4 Correct 552 ms 12140 KB Output is correct
5 Correct 542 ms 12140 KB Output is correct
6 Correct 8 ms 8172 KB Output is correct
7 Correct 7 ms 8172 KB Output is correct
8 Correct 7 ms 8228 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 7 ms 8172 KB Output is correct
2 Correct 7 ms 8172 KB Output is correct
3 Correct 10 ms 8172 KB Output is correct
4 Correct 8 ms 8172 KB Output is correct
5 Correct 7 ms 8172 KB Output is correct
6 Correct 7 ms 8172 KB Output is correct
7 Correct 7 ms 8172 KB Output is correct
8 Correct 8 ms 8300 KB Output is correct
9 Correct 8 ms 8172 KB Output is correct
10 Correct 7 ms 8172 KB Output is correct
11 Correct 85 ms 9196 KB Output is correct
12 Correct 7 ms 8172 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1124 ms 8556 KB Output is correct
2 Correct 1131 ms 8544 KB Output is correct
3 Correct 1129 ms 8552 KB Output is correct
4 Correct 1170 ms 8552 KB Output is correct
5 Correct 1107 ms 8544 KB Output is correct
6 Correct 7 ms 8172 KB Output is correct
7 Correct 7 ms 8172 KB Output is correct
8 Correct 7 ms 8172 KB Output is correct
9 Correct 5563 ms 8552 KB Output is correct
10 Correct 8 ms 8172 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1165 ms 16040 KB Output is correct
2 Correct 1103 ms 15980 KB Output is correct
3 Correct 1099 ms 16108 KB Output is correct
4 Correct 1147 ms 16876 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1100 ms 8556 KB Output is correct
2 Correct 1086 ms 8556 KB Output is correct
3 Correct 1111 ms 8552 KB Output is correct
4 Correct 1112 ms 8556 KB Output is correct
5 Correct 1112 ms 8544 KB Output is correct
6 Correct 1130 ms 16168 KB Output is correct
7 Correct 1109 ms 16132 KB Output is correct
8 Correct 1101 ms 16108 KB Output is correct
9 Correct 1163 ms 16876 KB Output is correct
10 Correct 527 ms 12012 KB Output is correct
11 Correct 532 ms 12136 KB Output is correct
12 Correct 628 ms 13676 KB Output is correct
13 Correct 536 ms 12136 KB Output is correct
14 Correct 530 ms 12136 KB Output is correct
15 Correct 7 ms 8172 KB Output is correct
16 Correct 7 ms 8172 KB Output is correct
17 Correct 7 ms 8172 KB Output is correct
18 Correct 7 ms 8172 KB Output is correct
19 Correct 7 ms 8172 KB Output is correct
20 Correct 8 ms 8172 KB Output is correct
21 Correct 7 ms 8172 KB Output is correct
22 Correct 7 ms 8172 KB Output is correct
23 Correct 8 ms 8172 KB Output is correct
24 Correct 7 ms 8172 KB Output is correct
25 Correct 92 ms 9196 KB Output is correct
26 Correct 8 ms 8172 KB Output is correct
27 Correct 5537 ms 8552 KB Output is correct
28 Execution timed out 20086 ms 16364 KB Time limit exceeded
29 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1108 ms 8560 KB Output is correct
2 Correct 1085 ms 8544 KB Output is correct
3 Correct 1124 ms 8552 KB Output is correct
4 Correct 1118 ms 8556 KB Output is correct
5 Correct 1104 ms 8544 KB Output is correct
6 Correct 1099 ms 15980 KB Output is correct
7 Correct 1106 ms 16256 KB Output is correct
8 Correct 1103 ms 16044 KB Output is correct
9 Correct 1151 ms 16940 KB Output is correct
10 Correct 535 ms 12140 KB Output is correct
11 Correct 537 ms 12264 KB Output is correct
12 Correct 609 ms 13676 KB Output is correct
13 Correct 530 ms 12012 KB Output is correct
14 Correct 535 ms 12140 KB Output is correct
15 Correct 10241 ms 16404 KB Output is correct
16 Execution timed out 20094 ms 16620 KB Time limit exceeded
17 Halted 0 ms 0 KB -