제출 #713268

#제출 시각아이디문제언어결과실행 시간메모리
713268hngwlog콤보 (IOI18_combo)C++14
100 / 100
39 ms576 KiB
#include <bits/stdc++.h> #include "combo.h" using namespace std; #define _size(x) (int)x.size() string guess_sequence(int n) { string ans = ""; int x = press("AB"); if (x) { x = press("A"); if (x) ans += 'A'; else ans += 'B'; } else { x = press("X"); if (x) ans += 'X'; else ans += 'Y'; } string t = "ABXY"; vector<char> ch; for (int i = 0; i < 4; i++) if (t[i] != ans[0]) ch.push_back(t[i]); if (_size(ans) == n) return ans; while (_size(ans) < n - 1) { x = press(ans + ch[0] + ch[0] + ans + ch[0] + ch[1] + ans + ch[0] + ch[2] + ans + ch[1]); if (x - _size(ans) == 2) ans += ch[0]; else if (x - _size(ans) == 1) ans += ch[1]; else ans += ch[2]; } x = press(ans + ch[0] + ans + ch[1]); if (x - _size(ans) == 0) ans += ch[2]; else if (press(ans + ch[0]) == n) ans += ch[0]; else ans += ch[1]; return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...