제출 #859122

#제출 시각아이디문제언어결과실행 시간메모리
859122Pekiban콤보 (IOI18_combo)C++17
100 / 100
14 ms2084 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; std::string guess_sequence(int n) { string f; if (press("AB")) { if (press("A")) { f = 'A'; } else { f = 'B'; } } else { if (press("X")) { f = 'X'; } else { f = 'Y'; } } if (n == 1) return f; string curr = ""; curr += f; char p, q, r; if (f == "A") { p = 'B', q = 'X', r = 'Y'; } else if (f == "B") { p = 'A', q = 'X', r = 'Y'; } else if (f == "X") { p = 'A', q = 'B', r = 'Y'; } else { p = 'A', q = 'B', r = 'X'; } for (int i = 1; i+1 < n; ++i) { const int z = press((curr+p)+p+(curr+p)+q+(curr+p)+r+(curr+q)); if (z == i+2) { curr += p; } else if (z == i+1) { curr += q; } else { curr += r; } } if (press(curr+p+curr+q) == n) { if (press(curr+p) == n) curr += p; else { curr += q; } } else { curr += r; } return curr; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...