Submission #144782

#TimeUsernameProblemLanguageResultExecution timeMemory
144782gmfabatCombo (IOI18_combo)C++14
100 / 100
77 ms592 KiB
#include "combo.h" using namespace std; typedef long long ll; typedef unsigned long long ull; string guess_sequence(int n) { string ans="",p=""; char a,b,c,d; if(press("AB")>0) { c='X'; d='Y'; if(press("A")==1) { a='A'; b='B'; } else { a='B'; b='A'; } } else { c='A'; d='B'; if(press("X")==1) { a='X'; b='Y'; } else { a='Y'; b='X'; } } ans=a; if(n==1)return ans; for(int i=1;i<n-1;i++) { p=ans+b+b+ans+b+c+ans+b+d+ans+c; int k=press(p); if(k==i) ans+=d; if(k==i+1) ans+=c; if(k==i+2) ans+=b; } if(press(ans+b)==n) ans+=b; else { if(press(ans+c)==n) ans+=c; else { ans+=d; } } return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...