Submission #230695

#TimeUsernameProblemLanguageResultExecution timeMemory
230695islingrCombo (IOI18_combo)C++14
100 / 100
60 ms592 KiB
#include <combo.h> #include <iostream> using namespace std; #define rep(i, a, b) for (auto i = (a); i < (b); ++i) char first = 'A'; string wlog(string s) { for (char &c : s) if (c == 'A') c = first; else if (c == first) c = 'A'; return s; } int ask(const string &p) { return press(wlog(p)); } string guess_sequence(int n) { if (ask("AB")) first = ask("A") ? 'A' : 'B'; else first = ask("X") ? 'X' : 'Y'; string s{'A'}; if (n > 1) { rep(i, 1, n - 1) { int cnt = ask(s + "BB" + s + "BX" + s + "BY" + s + "X"); if (cnt == i + 0) s += "Y"; if (cnt == i + 1) s += "X"; if (cnt == i + 2) s += "B"; } if (ask(s + "B" + s + "X") == n) s += ask(s + "B") == n ? "B" : "X"; else s += "Y"; } return wlog(s); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...