Submission #441548

#TimeUsernameProblemLanguageResultExecution timeMemory
441548impriCombo (IOI18_combo)C++14
100 / 100
35 ms584 KiB
#include "combo.h" std::string guess_sequence(int N) { char val[4]={'A','B','X','Y'}; std::string res="U"; std::string t="U"; int first=-1; t="AB"; if(press(t)){ t="A"; if(press(t)){ res[0]='A'; first=0; } else{ res[0]='B'; first=1; } } else{ t="X"; if(press(t)){ res[0]='X'; first=2; } else{ res[0]='Y'; first=3; } } if(N==1)return res; for(int i=1;i<N-1;i++){ t=res; for(int j=1;j<=3;j++) {t+=val[(first+1)%4];t+=val[(first+j)%4];t+=res;} t+=val[(first+2)%4]; int g=press(t); if(g==i+2) res+=val[(first+1)%4]; else if(g==i+1) res+=val[(first+2)%4]; else res+=val[(first+3)%4]; } if(press(res+val[(first+1)%4])==N) res+=val[(first+1)%4]; else if(press(res+val[(first+2)%4])==N) res+=val[(first+2)%4]; else res+=val[(first+3)%4]; return res; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...