Submission #993103

#TimeUsernameProblemLanguageResultExecution timeMemory
993103Yazan_SACave (IOI13_cave)C++17
Compilation error
0 ms0 KiB
#include "cave.h" #include<bits/stdc++.h> using namespace std; // int n=8,tot; // int S[]={1,1,0,1,1,0,0,0}; // int D[]={5,2,7,6,0,3,4,1}; // int F[8]={}; // int tryCombination(int s[]){ // for(int i=0; i<n; i++){ // F[D[i]]=i; // } // tot++; // int ac=0; // for(int i=0; i<n; i++){ // if(s[F[i]]==S[F[i]])ac=i; // else break; // } // return (ac==n-1 ? -1 : ac); // } // int n2; // int ask(int x[]){ // int ts=tryCombination(x)+1; // return (ts==0 ? n2 : ts); // } // void answer(int s[], int d[]){ // cout<<"try: \n"; // for(int i=0; i<n; i++)cout<<s[i]<<' ';cout<<'\n'; // for(int i=0; i<n; i++)cout<<S[i]<<' ';cout<<'\n'; // cout<<endl; // cout<<"try: \n"; // for(int i=0; i<n; i++)cout<<d[i]<<' ';cout<<'\n'; // for(int i=0; i<n; i++)cout<<D[i]<<' ';cout<<'\n'; // if(ask(s)==n)cout<<"YES"; // else cout<<"NO"; // cout<<endl<<tot; // } void exploreCave(int N) { n2=N; int d[N]={},s[N]={}; bool dn[N]={}; if(N==1){ if(ask(s)!=1)s[0]=1; answer(s,d); return; } int ts=ask(s),ts2; for(int i=0; i<N; i++){ int l=0,r=N-1; while(l<=r){ if(l==r){ // cout<<"FOUND "<<i<<" in "<<l<<endl; dn[l]=1; d[l]=i; // s[l]^=1; if(ts2<=i)s[l]^=1; ts=ask(s); break; } int md=(l+r)/2; for(int j=l; j<=md; j++){ if(dn[j])continue; s[j]^=1; } ts2=ask(s); // cout<<ts<<" # "<<l<<' '<<md<<' '<<r<<" !! ";for(int i=0; i<N; cout<<s[i++]<<' ');cout<<"!! "<<ts2<<endl; // for(int j=l; j<=md; j++){ // if(dn[j])continue; // s[j]^=1; // } if((ts<=i && ts2>=i+1) || (ts>=i+1 && ts2<=i)){ r=md; ts=ts2; } else{ l=md+1; } } } answer(s,d); } // signed main(){ // // n=10; // exploreCave(n); // }

Compilation message (stderr)

cave.cpp: In function 'void exploreCave(int)':
cave.cpp:46:5: error: 'n2' was not declared in this scope
   46 |     n2=N;
      |     ^~
cave.cpp:50:12: error: 'ask' was not declared in this scope
   50 |         if(ask(s)!=1)s[0]=1;
      |            ^~~
cave.cpp:54:12: error: 'ask' was not declared in this scope
   54 |     int ts=ask(s),ts2;
      |            ^~~
cave.cpp:63:20: error: 'ts2' was not declared in this scope; did you mean 'ts'?
   63 |                 if(ts2<=i)s[l]^=1;
      |                    ^~~
      |                    ts
cave.cpp:72:13: error: 'ts2' was not declared in this scope; did you mean 'ts'?
   72 |             ts2=ask(s);
      |             ^~~
      |             ts