Submission #234119

# Submission time Handle Problem Language Result Execution time Memory
234119 2020-05-23T08:08:00 Z tinjyu Wombats (IOI13_wombats) C++14
55 / 100
20000 ms 41848 KB
#include "wombats.h"
#include <iostream>
using namespace std;
long long int h[5005][205],v[5005][205],r,c,dp[5005][200];
void init(int R, int C, int H[5000][200], int V[5000][200]) {
    r=R;
    c=C;
    //cout<<r<<" "<<c<<endl;
    for(int i=0;i<r-1;i++)
    {
    	for(int j=0;j<c;j++)
    	{
    		v[i][j]=V[i][j];
    		
		}
	}
	for(int i=0;i<r;i++)
	{
		for(int j=0;j<c-1;j++)h[i][j]=H[i][j];
	}
}

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) {
	dp[0][v1]=0;
	long long int tmp=0;
	
	for(int i=v1-1;i>=0;i--)
	{
		tmp+=h[0][i];
		dp[0][i]=tmp;
	}
	tmp=0;
	for(int i=v1+1;i<c;i++)
	{
		tmp+=h[0][i-1];
		dp[0][i]=tmp;
	}
	for(int i=0;i<c;i++)
	{
		//cout<<dp[0][i]<<" ";
	}
	//cout<<endl;
	for(int i=0;i<r-1;i++)
	{
		long long int mi=dp[i][0];
		for(int j=0;j<c-1;j++)
		{
			mi=min(mi+h[i][j],dp[i][j+1]);
			dp[i][j+1]=mi;
			dp[i+1][j+1]=mi;
		}
		mi=dp[i][c-1];
		for(int j=c-2;j>=0;j--)
		{
			mi=min(mi+h[i][j],dp[i][j]);
			dp[i][j]=mi;
			dp[i+1][j]=mi;
		}
		for(int j=0;j<=c-1;j++)
		{
			//cout<<dp[i][j]<<" ";
		}
		//cout<<endl;
		for(int j=0;j<c;j++)
		{
			dp[i+1][j]=dp[i][j]+v[i][j];
			//cout<<dp[i][j]<<" "<<v[i][j]<<"  ";
		}
		//cout<<endl;
	}
	long long int i=r-1;
	long long int mi=dp[r-1][0];
	for(int j=0;j<c-1;j++)
	{
		mi=min(mi+h[i][j],dp[i][j+1]);
		dp[i][j+1]=mi;
		dp[i+1][j+1]=mi;
	}
	mi=dp[r-1][c-1];
	for(int j=c-2;j>=0;j--)
	{
		mi=min(mi+h[i][j],dp[i][j]);
		dp[i][j]=mi;
		dp[i+1][j]=mi;
	}
	for(int j=0;j<c;j++)
	{
		//cout<<dp[i][j]<<" ";
	}
	//cout<<endl;
    return dp[r-1][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;
      ^~~
# Verdict Execution time Memory Grader output
1 Correct 32 ms 20096 KB Output is correct
2 Correct 31 ms 20096 KB Output is correct
3 Correct 7601 ms 23220 KB Output is correct
4 Correct 32 ms 20096 KB Output is correct
5 Correct 33 ms 20096 KB Output is correct
6 Correct 5 ms 384 KB Output is correct
7 Correct 5 ms 384 KB Output is correct
8 Correct 5 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 384 KB Output is correct
2 Correct 4 ms 384 KB Output is correct
3 Correct 4 ms 384 KB Output is correct
4 Correct 5 ms 512 KB Output is correct
5 Correct 5 ms 512 KB Output is correct
6 Correct 5 ms 512 KB Output is correct
7 Correct 5 ms 512 KB Output is correct
8 Correct 5 ms 512 KB Output is correct
9 Correct 6 ms 512 KB Output is correct
10 Correct 5 ms 512 KB Output is correct
11 Correct 410 ms 2916 KB Output is correct
12 Correct 5 ms 512 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 12 ms 1024 KB Output is correct
2 Correct 11 ms 1024 KB Output is correct
3 Correct 12 ms 1024 KB Output is correct
4 Correct 12 ms 1152 KB Output is correct
5 Correct 12 ms 1024 KB Output is correct
6 Correct 5 ms 384 KB Output is correct
7 Correct 5 ms 384 KB Output is correct
8 Correct 4 ms 384 KB Output is correct
9 Correct 12 ms 1024 KB Output is correct
10 Correct 5 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 89 ms 32128 KB Output is correct
2 Correct 87 ms 32128 KB Output is correct
3 Correct 92 ms 32128 KB Output is correct
4 Correct 6855 ms 33976 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 12 ms 1024 KB Output is correct
2 Correct 12 ms 1024 KB Output is correct
3 Correct 12 ms 1152 KB Output is correct
4 Correct 12 ms 1152 KB Output is correct
5 Correct 12 ms 1024 KB Output is correct
6 Correct 90 ms 32128 KB Output is correct
7 Correct 86 ms 32248 KB Output is correct
8 Correct 87 ms 32128 KB Output is correct
9 Correct 6868 ms 33880 KB Output is correct
10 Correct 33 ms 20096 KB Output is correct
11 Correct 31 ms 20096 KB Output is correct
12 Correct 7841 ms 23200 KB Output is correct
13 Correct 34 ms 20224 KB Output is correct
14 Correct 32 ms 20096 KB Output is correct
15 Correct 5 ms 384 KB Output is correct
16 Correct 5 ms 384 KB Output is correct
17 Correct 5 ms 384 KB Output is correct
18 Correct 5 ms 512 KB Output is correct
19 Correct 6 ms 512 KB Output is correct
20 Correct 6 ms 512 KB Output is correct
21 Correct 6 ms 416 KB Output is correct
22 Correct 6 ms 512 KB Output is correct
23 Correct 5 ms 512 KB Output is correct
24 Correct 5 ms 512 KB Output is correct
25 Correct 413 ms 2936 KB Output is correct
26 Correct 5 ms 512 KB Output is correct
27 Correct 11 ms 1152 KB Output is correct
28 Execution timed out 20036 ms 35964 KB Time limit exceeded
29 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 12 ms 1024 KB Output is correct
2 Correct 13 ms 1024 KB Output is correct
3 Correct 16 ms 1024 KB Output is correct
4 Correct 12 ms 1280 KB Output is correct
5 Correct 12 ms 1152 KB Output is correct
6 Correct 94 ms 32148 KB Output is correct
7 Correct 87 ms 32128 KB Output is correct
8 Correct 91 ms 32248 KB Output is correct
9 Correct 6736 ms 33620 KB Output is correct
10 Correct 33 ms 20096 KB Output is correct
11 Correct 41 ms 20096 KB Output is correct
12 Correct 7367 ms 23096 KB Output is correct
13 Correct 38 ms 20096 KB Output is correct
14 Correct 36 ms 20224 KB Output is correct
15 Correct 309 ms 41848 KB Output is correct
16 Execution timed out 20084 ms 40220 KB Time limit exceeded
17 Halted 0 ms 0 KB -