Submission #157287

#TimeUsernameProblemLanguageResultExecution timeMemory
157287ZikXewenCave (IOI13_cave)C++11
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>
#include "graderlib.c"
using namespace std;

void exploreCave(int N){
	int st[N] = {}, nw[N] = {}, ga[N] = {}, ct = 0;
	vector<int> lf(N);
	iota(lf.begin(), lf.end(), 0);
	for(int i = 0; i < N; i++) {
		int l = 0, r = lf.size() - 1;
		bool op = (tryCombination(st) == i);
		while(l < r) {
			int m = (l + r) >> 1;
			copy(st, st + N, nw);
			for(int j = l; j <= m; j++) nw[lf[j]] = !st[lf[j]];
			if((tryCombination(nw) == i) != op) r = m;
			else l = m + 1;
		}
		st[lf[l]] = op;
		ga[lf[l]] = i; 
		lf.erase(lf.begin() + l);
	}
	answer(st, ga);
}

Compilation message (stderr)

cave.cpp: In function 'void exploreCave(int)':
cave.cpp:6:42: warning: unused variable 'ct' [-Wunused-variable]
  int st[N] = {}, nw[N] = {}, ga[N] = {}, ct = 0;
                                          ^~
/tmp/ccY1JUjy.o: In function `answer':
cave.cpp:(.text+0x0): multiple definition of `answer'
/tmp/ccgCGPoi.o:grader.c:(.text+0x0): first defined here
/tmp/ccY1JUjy.o: In function `tryCombination':
cave.cpp:(.text+0x90): multiple definition of `tryCombination'
/tmp/ccgCGPoi.o:grader.c:(.text+0x90): first defined here
/tmp/ccY1JUjy.o: In function `init()':
cave.cpp:(.text+0x140): multiple definition of `init()'
/tmp/ccgCGPoi.o:grader.c:(.text+0x140): first defined here
collect2: error: ld returned 1 exit status