Submission #401543

#TimeUsernameProblemLanguageResultExecution timeMemory
401543tredsused70Combo (IOI18_combo)C++17
5 / 100
2 ms328 KiB
#include <bits/stdc++.h> using namespace std; int press(string p); 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; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...