제출 #230692

#제출 시각아이디문제언어결과실행 시간메모리
230692islingrCombo (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 parse(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(parse(p)); } string guess_sequence(int n) { if (ask("AB")) first = ask("A") ? 'A' : 'B'; else first = ask("X") ? 'X' : 'Y'; string cur{'A'}; if (n > 1) { rep(i, 1, n - 1) { int cnt = ask(cur + "BB" + cur + "BX" + cur + "BY" + cur + "X"); if (cnt == i + 0) cur += "Y"; if (cnt == i + 1) cur += "X"; if (cnt == i + 2) cur += "B"; } if (ask(cur + "B" + cur + "X") == n) cur += ask(cur + "B") == n ? "B" : "X"; else cur += "Y"; } return parse(cur); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...