Submission #404343

#TimeUsernameProblemLanguageResultExecution timeMemory
404343hltkCombo (IOI18_combo)C++17
100 / 100
48 ms600 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; string guess_sequence(int N) { string p; if (press("AB")) { p = press("A") ? "A" : "B"; } else { p = press("X") ? "X" : "Y"; } if (N == 1) return p; vector<char> opts{'A', 'B', 'X', 'Y'}; opts.erase(find(opts.begin(), opts.end(), p[0])); for (int i = 1; i < N - 1; ++i) { string k; k += p + opts[2] + opts[0]; k += p + opts[2] + opts[1]; k += p + opts[2] + opts[2]; k += p + opts[1]; p += opts[press(k) - i]; } for (int j = 0; j < 2; ++j) { if (press(p + opts[j]) == N) { return p + opts[j]; } } return p + opts[2]; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...