Submission #58067

#TimeUsernameProblemLanguageResultExecution timeMemory
58067naderjemelCave (IOI13_cave)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; int s[5000],ss[5000],d[5000]; void exploreCave(int N) { for(int i=0;i<N;i++){ s[i]=0; d[i]=-1; } bool done[5005]; memset(done,false,sizeof(done)); for(int i=0;i<N;i++){ int lo=0,hi=N-1; int rs; int r=tryCombination(s); if(r==i){ // it opens with 1 while(lo<=hi){ int mid=(lo+hi)>>1; for(int j=mid;j<N;j++) ss[j]=s[j]; for(int j=lo;j<=mid;j++){ if(done[j]) ss[j]=s[j]; else ss[j]=1; } int rr=tryCombination(ss); if(rr==i){ lo=mid+1; } else{ hi=mid-1; rs=mid; } } d[rs]=i; done[rs]=true; s[rs]=1; } else{ // it opens with 0 while(lo<=hi){ int mid=(lo+hi)>>1; for(int j=mid;j<N;j++) ss[j]=s[j]; for(int j=lo;j<=mid;j++){ if(done[j]) ss[j]=s[j]; else ss[j]=1; } int rr=tryCombination(ss); if(rr==i){ hi=mid-1; rs=mid; } else{ lo=mid+1; } } d[rs]=i; done[rs]=true; s[rs]=0; } } answer(s,d); }

Compilation message (stderr)

cave.cpp: In function 'void exploreCave(int)':
cave.cpp:15:12: error: 'tryCombination' was not declared in this scope
      int r=tryCombination(s);
            ^~~~~~~~~~~~~~
cave.cpp:59:5: error: 'answer' was not declared in this scope
     answer(s,d);
     ^~~~~~
cave.cpp:59:5: note: suggested alternative: 'assert'
     answer(s,d);
     ^~~~~~
     assert