Submission #869484

#TimeUsernameProblemLanguageResultExecution timeMemory
869484adkjtCombo (IOI18_combo)C++14
100 / 100
13 ms1920 KiB
#include "combo.h" #include<bits/stdc++.h> using namespace std; string guess_sequence(int N) { //string p = ""; char ot[3]; string ans; if(press("AB")){ if(press("A")) ans="A",ot[0]='B',ot[1]='X',ot[2]='Y'; else ans="B",ot[0]='A',ot[1]='X',ot[2]='Y'; } else{ if(press("X")) 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'; } //cout<<ans.size(); 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; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...