Submission #123088

# Submission time Handle Problem Language Result Execution time Memory
123088 2019-06-30T07:58:00 Z Mahdi_Jfri Wombats (IOI13_wombats) C++14
55 / 100
20000 ms 17656 KB
#include "wombats.h"
#include<bits/stdc++.h>

using namespace std;

#define ll long long
#define pb push_back

const int maxn = 5e3 + 20;
const int maxm = 2e2 + 20;

int wH[maxn][maxm] , wV[maxn][maxm];

int d[maxm][maxm] , n , m;
bool have[maxm];

void dij(int src)
{
	if(have[src])
		return;

	have[src] = 1;
	memset(d[src] , 63 , 4 * m);
	d[src][src] = 0;

	for(int i = 0; i < n; i++)
	{
		for(int j = 0; j + 1 < m; j++)
			d[src][j + 1] = min(d[src][j + 1] , d[src][j] + wH[i][j]);
		for(int j = m - 2; j >= 0; j--)
			d[src][j] = min(d[src][j] , d[src][j + 1] + wH[i][j]);

		if(i + 1 < n)
			for(int j = 0; j < m; j++)
				d[src][j] += wV[i][j];
	}
}

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 + 1 < m; j++)
			wH[i][j] = H[i][j];	

	for(int i = 0; i + 1 < n; i++)
		for(int j = 0; j < m; j++)
			wV[i][j] = V[i][j];
}

void changeH(int P, int Q, int W)
{
	wH[P][Q] = W;
	memset(have , 0 , sizeof have);
}

void changeV(int P, int Q, int W)
{
	wV[P][Q] = W;
	memset(have , 0 , sizeof have);
}

int escape(int V1, int V2)
{
	dij(V1);
	return d[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]
  int res;
      ^~~
# Verdict Execution time Memory Grader output
1 Correct 19 ms 8568 KB Output is correct
2 Correct 20 ms 8568 KB Output is correct
3 Correct 90 ms 10232 KB Output is correct
4 Correct 19 ms 8572 KB Output is correct
5 Correct 19 ms 8568 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
8 Correct 2 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 548 KB Output is correct
6 Correct 3 ms 504 KB Output is correct
7 Correct 2 ms 476 KB Output is correct
8 Correct 2 ms 376 KB Output is correct
9 Correct 3 ms 376 KB Output is correct
10 Correct 2 ms 380 KB Output is correct
11 Correct 78 ms 1368 KB Output is correct
12 Correct 3 ms 504 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 9 ms 760 KB Output is correct
2 Correct 10 ms 760 KB Output is correct
3 Correct 10 ms 760 KB Output is correct
4 Correct 10 ms 760 KB Output is correct
5 Correct 10 ms 760 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
8 Correct 2 ms 376 KB Output is correct
9 Correct 7 ms 760 KB Output is correct
10 Correct 2 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 77 ms 16760 KB Output is correct
2 Correct 78 ms 16812 KB Output is correct
3 Correct 80 ms 16760 KB Output is correct
4 Correct 121 ms 17656 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 9 ms 760 KB Output is correct
2 Correct 10 ms 760 KB Output is correct
3 Correct 11 ms 760 KB Output is correct
4 Correct 10 ms 760 KB Output is correct
5 Correct 10 ms 760 KB Output is correct
6 Correct 78 ms 16760 KB Output is correct
7 Correct 78 ms 16760 KB Output is correct
8 Correct 79 ms 16848 KB Output is correct
9 Correct 118 ms 17548 KB Output is correct
10 Correct 19 ms 8568 KB Output is correct
11 Correct 19 ms 8568 KB Output is correct
12 Correct 89 ms 10204 KB Output is correct
13 Correct 19 ms 8572 KB Output is correct
14 Correct 20 ms 8568 KB Output is correct
15 Correct 2 ms 376 KB Output is correct
16 Correct 2 ms 376 KB Output is correct
17 Correct 2 ms 376 KB Output is correct
18 Correct 2 ms 376 KB Output is correct
19 Correct 2 ms 504 KB Output is correct
20 Correct 2 ms 376 KB Output is correct
21 Correct 2 ms 504 KB Output is correct
22 Correct 3 ms 376 KB Output is correct
23 Correct 2 ms 376 KB Output is correct
24 Correct 2 ms 376 KB Output is correct
25 Correct 78 ms 1424 KB Output is correct
26 Correct 2 ms 376 KB Output is correct
27 Correct 7 ms 632 KB Output is correct
28 Execution timed out 20065 ms 17192 KB Time limit exceeded
29 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 9 ms 812 KB Output is correct
2 Correct 9 ms 760 KB Output is correct
3 Correct 10 ms 780 KB Output is correct
4 Correct 10 ms 764 KB Output is correct
5 Correct 10 ms 760 KB Output is correct
6 Correct 80 ms 16732 KB Output is correct
7 Correct 81 ms 16812 KB Output is correct
8 Correct 77 ms 16732 KB Output is correct
9 Correct 120 ms 17504 KB Output is correct
10 Correct 19 ms 8568 KB Output is correct
11 Correct 20 ms 8628 KB Output is correct
12 Correct 89 ms 10104 KB Output is correct
13 Correct 20 ms 8568 KB Output is correct
14 Correct 20 ms 8600 KB Output is correct
15 Correct 254 ms 16736 KB Output is correct
16 Execution timed out 20020 ms 17152 KB Time limit exceeded
17 Halted 0 ms 0 KB -