Submission #870920

#TimeUsernameProblemLanguageResultExecution timeMemory
870920_unknown_2010Combo (IOI18_combo)C++17
Compilation error
0 ms0 KiB
#include<bits/stdc++.h> using namespace std; string guess_sequence(int N) { //string p = ""; char ot[3]; string ans; if(press("A")==1) ans="A",ot[0]='B',ot[1]='X',ot[2]='Y'; else if(press("B")==1) ans="B",ot[0]='A',ot[1]='X',ot[2]='Y'; else if(press("X")==1) ans="X",ot[0]='B',ot[1]='A',ot[2]='Y'; else ans="Y",ot[0]='B',ot[1]='X',ot[2]='A'; //int coins = press(p); string S; // cout<<N<<'\n'; if(N==1) return ans; for (int i = 2; i <N; ++i) { S = ans+ot[0]+ans+ot[1]+ot[0]+ans+ot[1]+ot[1]+ans+ot[1]+ot[2]; //cout<<S<<' '; // cout<<S.size()<<'\n'; int p=press(S); if(p==i-1) ans+=ot[2]; else if(p==i) ans+=ot[0]; else ans+=ot[1]; //cout<<ans<<'\n'; } if(press(ans+ot[0])==N) ans+=ot[0]; else if( press(ans+ot[1])==N) ans+=ot[1]; else ans+=ot[2]; return ans; }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:7:6: error: 'press' was not declared in this scope
    7 |   if(press("A")==1)
      |      ^~~~~
combo.cpp:23:11: error: 'press' was not declared in this scope
   23 |     int p=press(S);
      |           ^~~~~
combo.cpp:29:4: error: 'press' was not declared in this scope
   29 | if(press(ans+ot[0])==N) ans+=ot[0];
      |    ^~~~~