Submission #245748

#TimeUsernameProblemLanguageResultExecution timeMemory
245748mikoarmCombo (IOI18_combo)C++14
5 / 100
23 ms332 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 < min(N, 3); i++) { if (press(S+lista[0]) == i+1) S += lista[0]; else if (press(S+lista[1]) == i+1) S += lista[1]; else S += lista[2]; } for (int i = 3; i < N; i++) { int xd = press(S+lista[0]+S+lista[1]+lista[0]+S+lista[1]+lista[2]); if (xd == i) { S += lista[2]; } else if (xd == i+1) { S += lista[0]; } else { S += lista[1]; } } return S; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...