Submission #159597

#TimeUsernameProblemLanguageResultExecution timeMemory
159597maximath_1Cave (IOI13_cave)C++11
Compilation error
0 ms0 KiB
#include<bits/stdc++.h>
using namespace std;
#define all l, r
int s[5069], d[5069];
bool vis[5069];
void flipLever(int l, int r){
	for(int i=l; i<=r; i++) s[i]=1-s[i];
}
int findLever(int door, int n){
	int l=0, r=n-1;
	if(tryCombination(s)!=door) flipLever(all);
	while(l<r){
		int md=(l+r)/2;
		flipLever(l, md);
		int tmp=tryCombination(s);
		flipLever(l, md);
		if(tmp!=door) r=md;
		else l=md+1;
	}
	return l;
}
void exploreCave(int n){
	for(int i=0; i<n; i++){
		int lv=findLever(i, n);
		s[lv]=1-s[lv];
		d[lv]=i; vis[lv]=true;
	}
	answer(s, d);
}

Compilation message (stderr)

cave.cpp: In function 'int findLever(int, int)':
cave.cpp:11:5: error: 'tryCombination' was not declared in this scope
  if(tryCombination(s)!=door) flipLever(all);
     ^~~~~~~~~~~~~~
cave.cpp:15:11: error: 'tryCombination' was not declared in this scope
   int tmp=tryCombination(s);
           ^~~~~~~~~~~~~~
cave.cpp: In function 'void exploreCave(int)':
cave.cpp:28:2: error: 'answer' was not declared in this scope
  answer(s, d);
  ^~~~~~
cave.cpp:28:2: note: suggested alternative: 'assert'
  answer(s, d);
  ^~~~~~
  assert