Submission #59671

# Submission time Handle Problem Language Result Execution time Memory
59671 2018-07-22T21:38:31 Z spencercompton Wombats (IOI13_wombats) C++17
16 / 100
20000 ms 17596 KB
#include "wombats.h"
#include <bits/stdc++.h>
using namespace std;
int bel[5000][200];
int rig[5000][200];
int r, c;
bool v[5000][200];
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[2000];
	li[0].push_back(make_pair(0,V1));
	for(int i = 0; i<r; i++){
		for(int j = 0; j<c; j++){
			v[i][j] = false;
		}
	}
	int mo[4000];
	for(int i = 0; i<4000; i++){
		mo[i] = i%2000;
	}
	for(int zz = 0;; zz++){
		int z = zz%2000;
		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 zz;
			}
			if(v[y][x]){
				continue;
			}
			v[y][x] = true;
			int ny, nx;
			if(x>0){
				 ny = y;
				 nx = x-1; 
				if(!v[ny][nx]){
					li[mo[z+rig[ny][nx]]].push_back(make_pair(ny,nx));
				}
			}
			if(x<c-1){
				 ny = y;
				 nx = x+1;
				if(!v[ny][nx]){
					li[mo[z+rig[y][x]]].push_back(make_pair(ny,nx));
				}
			}
			if(y<r-1){
				 ny = y+1;
				 nx = x;
				if(!v[ny][nx]){
					li[mo[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:47: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 115 ms 9336 KB Output is correct
2 Correct 6224 ms 9440 KB Output is correct
3 Execution timed out 20015 ms 9440 KB Time limit exceeded
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 9440 KB Output is correct
2 Correct 2 ms 9440 KB Output is correct
3 Correct 2 ms 9440 KB Output is correct
4 Correct 13 ms 9440 KB Output is correct
5 Correct 13 ms 9440 KB Output is correct
6 Correct 58 ms 9440 KB Output is correct
7 Correct 28 ms 9440 KB Output is correct
8 Correct 41 ms 9440 KB Output is correct
9 Correct 49 ms 9440 KB Output is correct
10 Correct 38 ms 9440 KB Output is correct
11 Execution timed out 20045 ms 9440 KB Time limit exceeded
12 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 135 ms 9440 KB Output is correct
2 Correct 69 ms 9440 KB Output is correct
3 Correct 142 ms 9440 KB Output is correct
4 Correct 139 ms 9440 KB Output is correct
5 Correct 147 ms 9440 KB Output is correct
6 Correct 3 ms 9440 KB Output is correct
7 Correct 2 ms 9440 KB Output is correct
8 Correct 2 ms 9440 KB Output is correct
9 Correct 95 ms 9440 KB Output is correct
10 Correct 3 ms 9440 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 10737 ms 17396 KB Output is correct
2 Correct 904 ms 17420 KB Output is correct
3 Correct 10731 ms 17420 KB Output is correct
4 Execution timed out 20022 ms 17516 KB Time limit exceeded
# Verdict Execution time Memory Grader output
1 Correct 118 ms 17516 KB Output is correct
2 Correct 99 ms 17516 KB Output is correct
3 Correct 140 ms 17516 KB Output is correct
4 Correct 156 ms 17516 KB Output is correct
5 Correct 173 ms 17516 KB Output is correct
6 Correct 10582 ms 17516 KB Output is correct
7 Correct 850 ms 17516 KB Output is correct
8 Correct 10733 ms 17552 KB Output is correct
9 Execution timed out 20098 ms 17556 KB Time limit exceeded
10 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 135 ms 17556 KB Output is correct
2 Correct 66 ms 17556 KB Output is correct
3 Correct 117 ms 17556 KB Output is correct
4 Correct 127 ms 17556 KB Output is correct
5 Correct 114 ms 17556 KB Output is correct
6 Correct 10989 ms 17568 KB Output is correct
7 Correct 933 ms 17596 KB Output is correct
8 Correct 10535 ms 17596 KB Output is correct
9 Execution timed out 20017 ms 17596 KB Time limit exceeded
10 Halted 0 ms 0 KB -