Submission #916879

#TimeUsernameProblemLanguageResultExecution timeMemory
916879mpb_콤보 (IOI18_combo)C++17
30 / 100
23 ms1724 KiB
#include "combo.h" #include <bits/stdc++.h> std::string guess_sequence(int N) { using namespace std; auto guess = [&](string p) { return press(p); }; vector<string> ch = {"A", "B", "X", "Y"}; string fst = "?"; for (int i = 0; i < 3; i++) { string p = ch[i]; int coins = press(p); if (coins == 1) { fst = ch[i]; break; } } if (fst == "?") { fst = "Y"; } vector<string> nch = {}; for (auto x : ch) { if (x != fst) nch.push_back(x); } string ans = fst; for (int i = 1; i < N; i++) { bool found = false; for (int j = 0; j < 2; j++) { string tmp = ans + nch[j]; int coins = guess(tmp); if (coins == i + 1) { found = true; ans += nch[j]; break; } } if (!found) { ans += nch[2]; } } return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...