Submission #710900

#TimeUsernameProblemLanguageResultExecution timeMemory
710900BaytoroCave (IOI13_cave)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> //#include "cave.h" //#include "graderlib.c" using namespace std; int realS[5005],realD[5005],inv[5005]; int n; /*void answer(int s[], int d[]){ for(int i=0;i<n;i++) cout<<s[i]<<' ';// cout<<endl; for(int i=0;i<n;i++) cout<<d[i]<<' ';// bool ok=1; for(int i=0;i<n;i++){ ok&=(s[i]==realS[i]); ok&=(d[i]==realD[i]); } if(ok) cout<<"Correct\n"; else cout<<"Incorrect\n"; exit(0); } int tryCombination(int s[]){ for(int i=0;i<n;i++){ if(s[inv[i]]!=realS[inv[i]]) return i; } return -1; }*/ const int N=5005; int ans[N],used[N],s[N],d[N]; void exploreCave(int N) { n=N; for(int door=0;door<n;door++){ int t=0; for(int i=0;i<n;i++){ if(!used[i]) s[i]=0; } int id=tryCombination(s); if(id==door){ t=1; for(int i=0;i<n;i++) if(!used[i]) s[i]=1; } int l=0,r=n-1; while(l<r){ int md=(l+r)/2; for(int i=l;i<=md;i++){ if(!used[i]){ s[i]=!t; } } id=tryCombination(s); if(id==door){ for(int i=l;i<=md;i++) if(!used[i]) s[i]=t; for(int i=md+1;i<=r;i++) if(!used[i]) s[i]=!t; r=md; } else{ l=md+1; } } s[l]=t; used[l]=1; d[l]=door; } answer(s,d); } /*int main(){ cin>>n; for(int i=0;i<n;i++) cin>>realS[i]; for(int i=0;i<n;i++){ cin>>realD[i]; inv[realD[i]]=i; } exploreCave(n); }*/

Compilation message (stderr)

cave.cpp: In function 'void exploreCave(int)':
cave.cpp:36:10: error: 'tryCombination' was not declared in this scope
   36 |   int id=tryCombination(s);
      |          ^~~~~~~~~~~~~~
cave.cpp:64:2: error: 'answer' was not declared in this scope
   64 |  answer(s,d);
      |  ^~~~~~