Submission #529508

#TimeUsernameProblemLanguageResultExecution timeMemory
529508sunnatCombo (IOI18_combo)C++14
5 / 100
1 ms200 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; } int l = 1, L; for(int i = 2; i < n; i ++){ L = press(s+b+b+s+b+x+s+b+y+s+x); switch(L - l){ case 0: s.push_back(y[0]); break; case 1: s.push_back(x[0]); break; case 2: s.push_back(b[0]); break; } l = l+1; } 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...