제출 #675775

#제출 시각아이디문제언어결과실행 시간메모리
675775GGOSHAB콤보 (IOI18_combo)C++14
0 / 100
2 ms464 KiB
#include <iostream> #include <vector> #include "combo.h" #define PI 3.14159265359 using namespace std; typedef long long ll; typedef unsigned long long ull; typedef vector<int> bigInt; const ull INF = -1; string guess_sequence(int n) { string ans; ans.reserve(n); if (press("AB")) { if (press("A")) ans.push_back('A'); else ans.push_back('B'); } else { if (press("X")) ans.push_back('X'); else ans.push_back('Y'); } char ex = ans[0]; string t, letters = "ABXY", tl; for (char c : letters) if (c != ex) tl.push_back(c); t.reserve(4 * n); // TODO: Double guess bool x = 1; for (int i = 2; i <= n; ++i) { t = ""; t.reserve(4 * n); for (int i = 0; i < 3; ++i) { t += ans; t.push_back(tl[i]); t.push_back(tl[0]); } if (x) { int p = press(t.substr(0, (i << 1) + 2)); x = p == i; if (p >= i) { p = press(t.substr(0, i + 1)); if (p >= i) { ans.push_back(tl[0]); if (!x) { ans.push_back(tl[0]); i++; } } else { ans.push_back(tl[1]); if (!x) { ans.push_back(tl[0]); i++; } } } else { ans.push_back(tl[2]); } } else { x = 0; int p = press(t.substr(i + 1, i + 1)); if (p >= i) { ans.push_back(tl[1]); if (p > i) { x = 1; ans.push_back(tl[0]); i++; } else { ans.push_back(tl[2]); x = 1; } } } } return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...