Submission #131168

#TimeUsernameProblemLanguageResultExecution timeMemory
131168junodeveloperCombo (IOI18_combo)C++17
100 / 100
60 ms1332 KiB
#include <string> #include "combo.h" using namespace std; string guess_sequence(int N) { int r; string t = "ABXY", p, s = ""; r = press("AB"); if(r == 0) { r = press("X"); if(r == 0) s = "Y"; else s = "X"; } else { r = press("A"); if(r == 0) s = "B"; else s = "A"; } if(N == 1) return s; for(int i=0; i<4; i++) { if(t[i] == s[0]) { t = t.substr(0,i) + (i+1<4 ? t.substr(i+1) : ""); break; } } for(int i=1; i+1<N; i++) { p = ""; for(int j=0; j<3; j++) { p += s + t[0] + t[j]; } p += s + t[1]; r = press(p); if(r == i) { s += t[2]; } else if(r == i+1) { s += t[1]; } else s += t[0]; } r = press(s + t[0]); if(r == N) s += t[0]; else { r = press(s + t[1]); if(r == N) s += t[1]; else s += t[2]; } return s; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...