Submission #167407

# Submission time Handle Problem Language Result Execution time Memory
167407 2019-12-08T08:47:16 Z Peacher29 Cave (IOI13_cave) C++14
0 / 100
666 ms 460 KB
#include "cave.h"

bool biztos0[5000];
bool biztos1[5000];
int ask[5000];
int d[5000];
int s[5000];
int n;

int okk(int a, int b){
	for(int i=0;i<n;i++){
		if(biztos0[i]){
			ask[i]=0;
		} else if(biztos1[i]){
			ask[i]=1;
		} else {
			ask[i] = (a<=i && i<=b);
		}
	}
	return tryCombination(ask);
}

int okk2(int a, int b){
	for(int i=0;i<n;i++){
		if(biztos0[i]){
			ask[i]=0;
		} else if(biztos1[i]){
			ask[i]=1;
		} else {
			ask[i] = !(a<=i && i<=b);
		}
	}
	return tryCombination(ask);
}

void exploreCave(int N) {
	n=N;
	for(int i=0;i<n;i++){
		int a=0, b=n-1;
		bool c=0;
		if(okk(0,n-1)){
			c=1;
		}
		while(a!=b){
			int k=(a+b)/2+1;
			int o;
			if(c){
				o=okk(a,k);
			} else {
				o=okk2(a,k);
			}
			if(o>i){
				b=k;
			} else {
				a=k+1;
			}
		}
		if(c){
			biztos1[a]=1;
		} else {
			biztos0[a]=1;
		}
		d[a]=i;
		s[a]=c;
	}
	answer(s,d);
}
# Verdict Execution time Memory Grader output
1 Incorrect 510 ms 384 KB too much calls on tryCombination()
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 666 ms 460 KB too much calls on tryCombination()
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 384 KB too much calls on tryCombination()
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 384 KB too much calls on tryCombination()
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 510 ms 384 KB too much calls on tryCombination()
2 Halted 0 ms 0 KB -