Submission #59665

# Submission time Handle Problem Language Result Execution time Memory
59665 2018-07-22T21:23:54 Z spencercompton Wombats (IOI13_wombats) C++17
16 / 100
20000 ms 136884 KB
#include "wombats.h"
#include <bits/stdc++.h>
using namespace std;
int bel[5000][200];
int rig[5000][200];
int r, c;
void init(int R, int C, int H[5000][200], int V[5000][200]) {
	r = R;
	c = C;
	for(int i = 0; i<r; i++){
		for(int j =0 ; j<c; j++){
			if(i+1<r){
				bel[i][j] = V[i][j];
			}
			if(j+1<c){
				rig[i][j] = H[i][j];
			}
		}
	}
}

void changeH(int P, int Q, int W) {
	rig[P][Q] = W;
}

void changeV(int P, int Q, int W) {
	bel[P][Q] = W;
}

int escape(int V1, int V2) {
	int maxans = r + c;
	maxans *= 1000;
	vector<pair<int, int> > li[maxans];
	li[0].push_back(make_pair(0,V1));
	bool v[r][c];
	for(int i = 0; i<r; i++){
		for(int j = 0; j<c; j++){
			v[i][j] = false;
		}
	}
	for(int z = 0;; z++){
		for(int i =0; i<li[z].size(); i++){
			int y = li[z][i].first;
			int x = li[z][i].second;
			if(y==r-1 && x==V2){
				return z;
			}
			if(v[y][x]){
				continue;
			}
			v[y][x] = true;
			if(x>0){
				int ny = y;
				int nx = x-1;
				if(!v[ny][nx]){
					li[z+rig[ny][nx]].push_back(make_pair(ny,nx));
				}
			}
			if(x<c-1){
				int ny = y;
				int nx = x+1;
				if(!v[ny][nx]){
					li[z+rig[y][x]].push_back(make_pair(ny,nx));
				}
			}
			if(y<r-1){
				int ny = y+1;
				int nx = x;
				if(!v[ny][nx]){
					li[z+bel[y][x]].push_back(make_pair(ny,nx));
				}
			}
		}
		li[z].clear();
	}
    return -1;
}

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;
      ^~~
wombats.cpp: In function 'int escape(int, int)':
wombats.cpp:42:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for(int i =0; i<li[z].size(); i++){
                 ~^~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 19497 ms 125816 KB Output is correct
2 Execution timed out 20101 ms 125828 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 3 ms 125828 KB Output is correct
2 Correct 3 ms 125828 KB Output is correct
3 Correct 3 ms 125828 KB Output is correct
4 Correct 61 ms 125828 KB Output is correct
5 Correct 53 ms 125828 KB Output is correct
6 Correct 88 ms 125828 KB Output is correct
7 Correct 69 ms 125828 KB Output is correct
8 Correct 69 ms 125828 KB Output is correct
9 Correct 78 ms 125828 KB Output is correct
10 Correct 73 ms 125828 KB Output is correct
11 Execution timed out 20010 ms 125828 KB Time limit exceeded
12 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 342 ms 125828 KB Output is correct
2 Correct 142 ms 125828 KB Output is correct
3 Correct 265 ms 125828 KB Output is correct
4 Correct 276 ms 125828 KB Output is correct
5 Correct 325 ms 125828 KB Output is correct
6 Correct 2 ms 125828 KB Output is correct
7 Correct 4 ms 125828 KB Output is correct
8 Correct 4 ms 125828 KB Output is correct
9 Correct 334 ms 125828 KB Output is correct
10 Correct 3 ms 125828 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 20102 ms 135836 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 247 ms 135836 KB Output is correct
2 Correct 119 ms 135836 KB Output is correct
3 Correct 279 ms 135836 KB Output is correct
4 Correct 262 ms 135836 KB Output is correct
5 Correct 321 ms 135836 KB Output is correct
6 Execution timed out 20092 ms 136368 KB Time limit exceeded
7 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 272 ms 136368 KB Output is correct
2 Correct 128 ms 136368 KB Output is correct
3 Correct 298 ms 136368 KB Output is correct
4 Correct 296 ms 136368 KB Output is correct
5 Correct 309 ms 136368 KB Output is correct
6 Execution timed out 20098 ms 136884 KB Time limit exceeded
7 Halted 0 ms 0 KB -