Submission #683112

#TimeUsernameProblemLanguageResultExecution timeMemory
683112bebraCombo (IOI18_combo)C++17
5 / 100
1 ms284 KiB
#include <bits/stdc++.h> #include "combo.h" using namespace std; #define dbg(x) cerr << #x << ": " << x << endl; const char chars[] = {'A', 'B', 'X', 'Y'}; int press(string p); string guess_sequence(int n) { char first_char; if (press("AB")) { if (press("A")) { first_char = 'A'; } else { first_char = 'B'; } } else { if (press("X")) { first_char = 'X'; } else { first_char = 'Y'; } } string good; for (auto c : chars) { if (c != first_char) good += c; } string res = string(1, first_char); for (int i = 2; i <= n - 1; ++i) { string t; t += res + good[0]; t += res + good[1] + good[0]; t += res + good[1] + good[1]; t += res + good[1] + good[2]; int len = press(t); if (len == i) { res += good[0]; } else if (len == i + 1) { res += good[1]; } else { res += good[2]; } } if (press(res + good[0]) == n) { res += good[0]; } else { if (press(res + good[1]) == n) { res += good[1]; } else { res += good[2]; } } return res; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...