Submission #1223074

#TimeUsernameProblemLanguageResultExecution timeMemory
1223074madamadam3콤보 (IOI18_combo)C++20
0 / 100
0 ms408 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; using str = string; #define rep(x) for (auto &x : CHARS) #define each(x, a) for (auto &x : a) default_random_engine rng; str guess_sequence(int N) { rng = default_random_engine(chrono::system_clock::now().time_since_epoch().count()); vector<str> CHARS = {"A", "B", "X", "Y"}; shuffle(CHARS.begin(), CHARS.end(), rng); str fst = CHARS[0]; for (int i = 1; i <= 3; i++) { if (press(CHARS[i]) == 1) { fst = CHARS[i]; break; } } vector<string> nchars; for (int i = 0; i < 4; i++) if (CHARS[i] != fst) nchars.push_back(CHARS[i]); str pref = fst; while (pref.size() < N) { bool found = false; shuffle(nchars.begin(), nchars.end(), rng); for (int k = 0; k <= 1; k++) { str guess_string = pref + nchars[k] + fst + pref + nchars[k] + nchars[k] + pref + nchars[k] + nchars[k] + nchars[k]; int ans = press(guess_string); if (ans <= pref.size()) continue; found = true; pref += nchars[k]; if (ans >= pref.size() + 2) pref += nchars[k]; if (ans >= pref.size() + 3) pref += nchars[k]; break; } if (found == false) pref += nchars[2]; } return pref; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...