제출 #237698

#제출 시각아이디문제언어결과실행 시간메모리
237698lucifer1004콤보 (IOI18_combo)C++17
5 / 100
1 ms276 KiB
#include <iostream> #include <set> #include <vector> using namespace std; int press(string s); string guess_sequence(int N) { string ans; int ab = press("AB"); if (ab == 0) { int x = press("X"); if (x == 0) ans += "Y"; else ans += "X"; } else { int a = press("A"); if (a == 0) ans += "B"; else ans += "A"; } set<char> s = {'A', 'B', 'X', 'Y'}; s.erase(ans[0]); vector<char> sv(s.begin(), s.end()); for (int i = 2; i < N; ++i) { string a(ans), b(ans); a.push_back(sv[0]); b.push_back(sv[1]); string a1(a), a2(a), a3(a); a1.push_back(sv[0]); a2.push_back(sv[1]); a3.push_back(sv[2]); int q = press(a1 + a2 + a3 + b); if (q == i + 1) ans.push_back(sv[0]); if (q == i) ans.push_back(sv[1]); if (q == i - 1) ans.push_back(sv[2]); } string a(ans), b(ans); a.push_back(sv[0]); int qa = press(a); if (qa == N) return a; b.push_back(sv[1]); int qb = press(b); if (qb == N) return b; ans.push_back(sv[2]); return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...