Submission #768357

#TimeUsernameProblemLanguageResultExecution timeMemory
768357SanguineChameleonCombo (IOI18_combo)C++17
100 / 100
27 ms564 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; const string buttons[4] = {"A", "B", "X", "Y"}; string guess_sequence(int N) { int first = press("AB") ? press("B") : press("Y") + 2; string res = buttons[first]; if (N == 1) { return res; } vector<int> rem; for (int i = 0; i < 4; i++) { if (i != first) { rem.push_back(i); } } for (int i = 0; i < N - 2; i++) { string seq = res + buttons[rem[1]]; for (int j = 0; j < 3; j++) { seq += res + buttons[rem[2]] + buttons[rem[j]]; } res += buttons[rem[press(seq) - i - 1]]; } int last = press(res + "A" + res + "B") == N ? press(res + "B") - N + 1 : press(res + "Y") - N + 3; res += buttons[last]; return res; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...