Submission #848719

#TimeUsernameProblemLanguageResultExecution timeMemory
848719toma_ariciuCombo (IOI18_combo)C++17
5 / 100
1 ms344 KiB
#include <string> using namespace std; string c[3], str, aux; int press(string p); void initC(string x, string y, string z) { c[0] = x; c[1] = y; c[2] = z; } string guess_sequence(int N) { int x = press("AB"), y; if (x > 0) { y = press("A"); if (y > 0) { str = "A"; initC("B", "X", "Y"); } else { str = "B"; initC("A", "X", "Y"); } } else { y = press("X"); if (y > 0) { str = "X"; initC("A", "B", "Y"); } else { str = "Y"; initC("A", "B", "X"); } } for (int i = 2; i < N; i++) { aux = str + c[0]; for (int j = 0; j < 3; j++) { aux = aux + str + c[1] + c[j]; } x = press(aux); if (x == i - 1) { str = str + c[2]; } if (x == i) { str = str + c[0]; } if (x == i + 1) { str = str + c[1]; } } for (int i = 0; i < 2; i++) { aux = str + c[i]; x = press(aux); if (x == N) { return aux; } } aux = str + c[2]; return aux; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...