Submission #115286

# Submission time Handle Problem Language Result Execution time Memory
115286 2019-06-06T15:29:19 Z faustaadp Wombats (IOI13_wombats) C++17
9 / 100
72 ms 17820 KB
#include "wombats.h"
#include<bits/stdc++.h>
typedef long long ll;
#define pb push_back
#define mp make_pair
#define fi first
#define se second
using namespace std;
ll n,m,i,j,x[5050][220],y[5050][220],jum,d[2][5050][2];
void upd()
{
	ll ii;
	d[0][n-1][0]=0;
	d[0][n-1][1]=x[n-1][0];
	d[1][n-1][1]=0;
	d[1][n-1][0]=x[n-1][0];
	for(ii=n-2;ii>=0;ii--)
	{
		d[0][ii][0]=min(d[0][ii+1][0]+y[ii][0],d[0][ii+1][1]+y[ii][1]+x[ii][0]);
		d[0][ii][1]=min(d[0][ii+1][1]+y[ii][1],d[0][ii+1][0]+y[ii][0]+x[ii][0]);
		d[1][ii][0]=min(d[1][ii+1][0]+y[ii][0],d[1][ii+1][1]+y[ii][1]+x[ii][0]);
		d[1][ii][1]=min(d[1][ii+1][1]+y[ii][1],d[1][ii+1][0]+y[ii][0]+x[ii][0]);
	}
}
void init(int R, int C, int H[5000][200], int V[5000][200]) 
{
	n=R;
	m=C;
	for(i=0;i<n;i++)
		for(j=1;j<(m-1);j++)
			x[i][j]=H[i][j];
	for(i=0;i<(n-1);i++)
		for(j=0;j<m;j++)
			y[i][j]=V[i][j];
	if(m==2)
	{
		upd();
	}
	else
	{
		for(i=0;i<(n-1);i++)
			jum+=y[i][0];
	}
    /* ... */
}

void changeH(int P, int Q, int W) 
{
	if(m==2)
	{
		x[P][Q]=W;
		upd();
	}
    /* ... */
}

void changeV(int P, int Q, int W) {
	if(m==2)
	{
		y[P][Q]=W;
		upd();
	}
	else
	{		
		jum-=y[P][Q];
		y[P][Q]=W;
		jum+=y[P][Q];
	}
    /* ... */
}

int escape(int V1, int V2) 
{
	if(m==2)
	{
		return d[V2][0][V1];
	}
	else
	{
		return jum;
	}
}

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 12 ms 12928 KB Output is correct
2 Correct 13 ms 12928 KB Output is correct
3 Correct 72 ms 14676 KB Output is correct
4 Correct 12 ms 12928 KB Output is correct
5 Correct 12 ms 12928 KB Output is correct
6 Correct 2 ms 384 KB Output is correct
7 Correct 2 ms 384 KB Output is correct
8 Correct 2 ms 256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 256 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 2 ms 256 KB Output is correct
4 Incorrect 2 ms 384 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 896 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 57 ms 17820 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 896 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 896 KB Output isn't correct
2 Halted 0 ms 0 KB -