Submission #529509

#TimeUsernameProblemLanguageResultExecution timeMemory
529509sunnatCombo (IOI18_combo)C++14
100 / 100
34 ms480 KiB
#include "combo.h" using namespace std; string guess_sequence(int n){ string s; if(press("AB")){ if(press("A")) s = "A"; else s = "B"; } else{ if(press("X")) s = "X"; else s = "Y"; } string b, x, y; switch(s[0]){ case 'A': b = "B", x = "X", y = "Y"; break; case 'B': b = "A", x = "X", y = "Y"; break; case 'X': b = "B", x = "A", y = "Y"; break; case 'Y': b = "B", x = "X", y = "A"; break; } if(n == 1) return s; int L; for(int i = 2; i < n; i ++){ L = press(s+b+b+s+b+x+s+b+y+s+x); switch(L - s.size()){ case 0: s.push_back(y[0]); break; case 1: s.push_back(x[0]); break; case 2: s.push_back(b[0]); break; } } if(press(s+b) == n) return s + b; if(press(s+x) == n) return s + x; return s + y; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...