Submission #163130

#TimeUsernameProblemLanguageResultExecution timeMemory
163130mhy908Cave (IOI13_cave)C++14
Compilation error
0 ms0 KiB
#include "cave.h" int now[5010], where[5010]; bool ch[5010]; void rev(int a, int b){ for(int i=a; i<=b; i++)if(!ch[i])now[i]^=1; } int binsearch(int st, int fin, bool fl, int num){ if(st==fin)return st; int mid=(st+fin)/2; assert(tryCombination(now)>=num); if(fl){ rev(st, mid); if(tryCombination(now)!=num){ rev(st, mid); return binsearch(st, mid, fl, num); } rev(st, mid); return binsearch(mid+1, fin, fl, num); } else{ rev(st, mid); if(tryCombination(now)==num){ rev(st, mid); return binsearch(st, mid, fl, num); } rev(st, mid); return binsearch(mid+1, fin, fl, num); } } void exploreCave(int n){ for(int i=0; i<n; i++){ int temp=tryCombination(now); int but=binsearch(0, n-1, temp==i, i); if(temp==i){ where[but]=i; ch[but]=true; } else{ where[but]=i; rev(but, but); ch[but]=true; } } answer(now, where); }

Compilation message (stderr)

cave.cpp: In function 'int binsearch(int, int, bool, int)':
cave.cpp:10:5: error: 'assert' was not declared in this scope
     assert(tryCombination(now)>=num);
     ^~~~~~
cave.cpp:10:5: note: suggested alternative: 'answer'
     assert(tryCombination(now)>=num);
     ^~~~~~
     answer