Submission #401550

#TimeUsernameProblemLanguageResultExecution timeMemory
401550tredsused70Combo (IOI18_combo)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; string guess_sequence(int n) { string ans,help; char st; if(press("AX")) { if(press("A")==1) ans="A"; else ans="X"; } else { if(press("B")==1) ans="B"; else ans="Y"; } st=ans[0]; int t; for(int i=1;i<n-1;i++) { if(st=='A') { help=ans+"BB"+ans+"BY"+ans+"BX"+ans+"Y"; t=press(help); if(t==i+2) ans+="B"; if(t==i+1) ans+="Y"; if(t==i) ans+="X"; } if(st=='B') { help=ans+"AA"+ans+"AY"+ans+"AX"+ans+"Y"; t=press(help); if(t==i+2) ans+="A"; if(t==i+1) ans+="Y"; if(t==i) ans+="X"; } if(st=='Y') { help=ans+"AA"+ans+"AB"+ans+"AX"+ans+"B"; t=press(help); if(t==i+2) ans+="A"; if(t==i+1) ans+="B"; if(t==i) ans+="X"; } if(st=='X') { help=ans+"AA"+ans+"AB"+ans+"AY"+ans+"B"; t=press(help); if(t==i+2) ans+="A"; if(t==i+1) ans+="B"; if(t==i) ans+="Y"; } help.clear(); } help=ans+"B"+ans+"A"; if(press(help)==n) { if(press(ans+"B")==n) ans+="B"; else ans+="A"; } else { if(press(ans+"X")==n) ans+="X"; else ans+="Y"; } return ans; }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:9:8: error: 'press' was not declared in this scope
    9 |     if(press("AX"))
      |        ^~~~~
combo.cpp:30:15: error: 'press' was not declared in this scope
   30 |             t=press(help);
      |               ^~~~~
combo.cpp:41:15: error: 'press' was not declared in this scope
   41 |             t=press(help);
      |               ^~~~~
combo.cpp:52:15: error: 'press' was not declared in this scope
   52 |             t=press(help);
      |               ^~~~~
combo.cpp:63:15: error: 'press' was not declared in this scope
   63 |             t=press(help);
      |               ^~~~~
combo.cpp:74:8: error: 'press' was not declared in this scope
   74 |     if(press(help)==n)
      |        ^~~~~