Submission #245749

#TimeUsernameProblemLanguageResultExecution timeMemory
245749mikoarmCombo (IOI18_combo)C++14
100 / 100
39 ms552 KiB
#include <bits/stdc++.h> #include "combo.h" using namespace std; string guess_sequence(int N) { char fl; if (press("AB")) { if (press("A")) fl = 'A'; else fl = 'B'; } else { if (press("X")) fl = 'X'; else fl = 'Y'; } vector<char> lista; for (char c : {'A', 'B', 'X', 'Y'}) if (c != fl) lista.push_back(c); string S(1, fl); if (N == 1) return S; for (int i = 1; i < N-1; i++) { int xd = press(S+lista[0]+S+lista[1]+lista[0]+S+lista[1]+lista[1]+S+lista[1]+lista[2]); if (xd == i) { S += lista[2]; } else if (xd == i+1) { S += lista[0]; } else { S += lista[1]; } } for (int i = 0; i < 2; i++) { if (press(S+lista[i]) == N) { S += lista[i]; break; } } if ((int)S.size() < N) S += lista[2]; return S; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...