Submission #441530

#TimeUsernameProblemLanguageResultExecution timeMemory
441530impriCombo (IOI18_combo)C++14
5 / 100
1 ms296 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; for(int i=0;i<3;i++){ t[0]=val[i]; if(press(t)){res[0]=t[0];first=i;break;} } if(res[0]=='U'){res[0]='Y';first=3;} 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...