Submission #231417

#TimeUsernameProblemLanguageResultExecution timeMemory
231417TehillahCave (IOI13_cave)C++14
0 / 100
6 ms384 KiB
#include "cave.h"
 
#define REP(i, a, b) for(int i=(int)(a); i<(int)(b); ++i)
void exploreCave(int N) {
	int S[N], D[N];
	for(int i=0; i<N; ++i) S[i] = 1;
	int ret, lst = 0;	
	while(1) {
		ret = tryCombination(S);
		int end = ret;
		if(ret == -1) end = N; 
		int p = end;
		REP(i, lst, N) {
			//flip ith switch
			S[i] = !S[i];
			ret = tryCombination(S);
			if(ret < end) {
				D[i] = ret;
				S[i] = !S[i];
				--p;
			} else if(ret == end) {
				D[i] = ret;
				--p;
			} else
				S[i] = !S[i];
			if(p == 0) break;
		}
		lst = end;
		if(end == N) break;
	}
}

Compilation message (stderr)

cave.cpp: In function 'void exploreCave(int)':
cave.cpp:5:12: warning: variable 'D' set but not used [-Wunused-but-set-variable]
  int S[N], D[N];
            ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...