답안 #384087

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
384087 2021-03-31T12:11:25 Z kshitij_sodani 웜뱃 (IOI13_wombats) C++14
55 / 100
20000 ms 28076 KB
//#pragma GCC optimize("Ofast,unroll-loops")
#include <bits/stdc++.h>
using namespace std;
typedef long long llo;
#define mp make_pair
#define pb push_back
#define a first 
#define b second
#define endl '\n'




#include "wombats.h"
int aa[5000][201];
int bb[5000][201];
int dp[5000][201];
int n,m;
int su=0;
void init(int R, int C, int H[5000][200], int V[5000][200]) {
	n=R;
	m=C;
	for(int i=0;i<n;i++){
		for(int j=0;j<m-1;j++){
			aa[i][j]=H[i][j];
			su+=aa[i][j];
		}
	}
	for(int j=0;j<m;j++){
		for(int i=0;i<n-1;i++){
			bb[i][j]=V[i][j];
			su+=bb[i][j];
		}
	}
    /* ... */
}

void changeH(int p, int q, int w) {
    /* ... */
	aa[p][q]=w;


}

void changeV(int p, int q, int w) {
    /* ... */
	bb[p][q]=w;


}

int escape(int c, int d) {
	//return 0;
	for(int i=0;i<n;i++){
		for(int j=0;j<m;j++){
			dp[i][j]=1e9;
		}
	}
	dp[0][c]=0;
	for(int i=0;i<n;i++){

		for(int j=0;j<m;j++){
			if(i>0){
				dp[i][j]=min(dp[i][j],dp[i-1][j]+bb[i-1][j]);
			}
		}
		for(int j=0;j<m-1;j++){
			dp[i][j+1]=min(dp[i][j+1],dp[i][j]+aa[i][j]);
		}
		for(int j=m-1;j>0;j--){
			dp[i][j-1]=min(dp[i][j-1],dp[i][j]+aa[i][j-1]);
		}	
	}
	/*for(int i=0;i<n;i++){
		for(int j=0;j<m;j++){
			cout<<dp[i][j]<<",";
		}
		cout<<endl;
	}
*/

    return dp[n-1][d];
}

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 36 ms 12140 KB Output is correct
2 Correct 38 ms 12140 KB Output is correct
3 Correct 11591 ms 15248 KB Output is correct
4 Correct 37 ms 12156 KB Output is correct
5 Correct 37 ms 12140 KB Output is correct
6 Correct 1 ms 364 KB Output is correct
7 Correct 1 ms 364 KB Output is correct
8 Correct 1 ms 364 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 2 ms 492 KB Output is correct
5 Correct 2 ms 492 KB Output is correct
6 Correct 2 ms 492 KB Output is correct
7 Correct 2 ms 492 KB Output is correct
8 Correct 2 ms 492 KB Output is correct
9 Correct 2 ms 492 KB Output is correct
10 Correct 2 ms 512 KB Output is correct
11 Correct 504 ms 2924 KB Output is correct
12 Correct 2 ms 492 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 11 ms 876 KB Output is correct
2 Correct 8 ms 748 KB Output is correct
3 Correct 8 ms 876 KB Output is correct
4 Correct 8 ms 876 KB Output is correct
5 Correct 9 ms 876 KB Output is correct
6 Correct 1 ms 364 KB Output is correct
7 Correct 2 ms 364 KB Output is correct
8 Correct 1 ms 364 KB Output is correct
9 Correct 9 ms 876 KB Output is correct
10 Correct 1 ms 364 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 113 ms 20008 KB Output is correct
2 Correct 116 ms 20076 KB Output is correct
3 Correct 118 ms 20076 KB Output is correct
4 Correct 9985 ms 21872 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 9 ms 1024 KB Output is correct
2 Correct 9 ms 748 KB Output is correct
3 Correct 9 ms 876 KB Output is correct
4 Correct 9 ms 876 KB Output is correct
5 Correct 9 ms 876 KB Output is correct
6 Correct 118 ms 20076 KB Output is correct
7 Correct 110 ms 20076 KB Output is correct
8 Correct 115 ms 20076 KB Output is correct
9 Correct 10119 ms 21528 KB Output is correct
10 Correct 37 ms 12140 KB Output is correct
11 Correct 37 ms 12140 KB Output is correct
12 Correct 11484 ms 14956 KB Output is correct
13 Correct 37 ms 12140 KB Output is correct
14 Correct 36 ms 12140 KB Output is correct
15 Correct 1 ms 364 KB Output is correct
16 Correct 1 ms 364 KB Output is correct
17 Correct 1 ms 364 KB Output is correct
18 Correct 2 ms 492 KB Output is correct
19 Correct 2 ms 492 KB Output is correct
20 Correct 2 ms 492 KB Output is correct
21 Correct 2 ms 492 KB Output is correct
22 Correct 2 ms 492 KB Output is correct
23 Correct 2 ms 492 KB Output is correct
24 Correct 2 ms 492 KB Output is correct
25 Correct 481 ms 2796 KB Output is correct
26 Correct 2 ms 492 KB Output is correct
27 Correct 9 ms 876 KB Output is correct
28 Execution timed out 20089 ms 23740 KB Time limit exceeded
29 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 8 ms 876 KB Output is correct
2 Correct 8 ms 748 KB Output is correct
3 Correct 8 ms 876 KB Output is correct
4 Correct 8 ms 876 KB Output is correct
5 Correct 8 ms 876 KB Output is correct
6 Correct 119 ms 20076 KB Output is correct
7 Correct 110 ms 20076 KB Output is correct
8 Correct 118 ms 20076 KB Output is correct
9 Correct 9989 ms 21992 KB Output is correct
10 Correct 37 ms 12140 KB Output is correct
11 Correct 37 ms 12268 KB Output is correct
12 Correct 11600 ms 15452 KB Output is correct
13 Correct 38 ms 12140 KB Output is correct
14 Correct 38 ms 12140 KB Output is correct
15 Correct 249 ms 26476 KB Output is correct
16 Execution timed out 20032 ms 28076 KB Time limit exceeded
17 Halted 0 ms 0 KB -