Submission #530068

#TimeUsernameProblemLanguageResultExecution timeMemory
530068buidangnguyen05Cave (IOI13_cave)C++14
Compilation error
0 ms0 KiB
/* input

*/

//#include "cave.h"
#include<bits/stdc++.h>
using namespace std;

typedef long long ll;
const int N = 5e3;
int n, done[N], state[N], que[N];

int query(int R) {
	for (int i = 0; i < n; ++i) {
		if (done[i] != -1) que[i] = state[i];
		else que[i] = (i <= R);
	}
	return tryCombination(que);
}

void exploreCave(int _n) {
	memset(done, -1, sizeof(done));
	n = _n; 
	int prev = query(0);
	for (int i = 0; i < n; ++i) {
		int L = -1, R = n - 1, pos = 0;
		while (L <= R) {
			int mid = (L + R) >> 1;
			int cur = query(mid); 
			if ((prev == i && cur != i) || (prev != i && cur == i)) {
				pos = mid;
				R = mid - 1;
			}
			else L = mid + 1;
		}
		if (prev == i) state[pos] = 1;
		done[pos] = i;
		prev = query(0); 
	}
	answer(state, done);
}

Compilation message (stderr)

cave.cpp: In function 'int query(int)':
cave.cpp:18:9: error: 'tryCombination' was not declared in this scope
   18 |  return tryCombination(que);
      |         ^~~~~~~~~~~~~~
cave.cpp: In function 'void exploreCave(int)':
cave.cpp:40:2: error: 'answer' was not declared in this scope
   40 |  answer(state, done);
      |  ^~~~~~