Submission #433851

#TimeUsernameProblemLanguageResultExecution timeMemory
433851frodakcinCombo (IOI18_combo)C++11
100 / 100
52 ms476 KiB
#include "combo.h" #include <cstdio> char btn[]="ABXY"; std::string guess_sequence(int N) { std::string p = ""; int first=0; first |= !!press("BY"); first |= !!press("XY")<<1; std::string poss=""; for(int i=0;i<4;++i) if(i!=first) poss.push_back(btn[i]); std::string S = ""; S += btn[first]; for(int i=1;i+1<N;++i) { p=""; p += (S+poss[1]); p += (S+poss[2]+poss[0]); p += (S+poss[2]+poss[1]); p += (S+poss[2]+poss[2]); S += poss[press(p)-i]; } if(N>1) { int last=0; for(;last<2;++last) if(press(S+poss[last])==N) break; S += poss[last]; } return S; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...