# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1154608 | omtheprogrammer1 | Combo (IOI18_combo) | C++17 | 0 ms | 0 KiB |
// int press(string s) {
// return 0;
// }
string guess_sequence(int N) {
string s, t;
n = N;
char first = '?';
s = "ABXY";
if (press("AB")) {
if (press("A")) {
first = 'A';
}
else {
first = 'B';
}
}
else {
if (press("X")) {
first = 'X';
}
else {
first = 'Y';
}
}
t = first;
string keep = "";
FOR(4) if (first != s[i])keep += s[i];
FOR(i, 1, n) {
if (i == n - 1) {
if (press(t + keep[0]) == n) {
t += keep[0];
}
else if (press(t + keep[1])) {
t += keep[1];
}
else {
t += keep[2];
}
return t;
}
string cur;
cur = t + keep[0] + t + keep[1] + keep[0] + t + keep[1] + keep[1] + t + keep[1] + keep[2];
int temp = press(cur);
if (temp == i) {
t += keep[2];
}
else if (temp == i + 1) {
t += keep[0];
}
else {
t += keep[1];
}
}
return t;
}
// int main() {
// fastio
// #ifdef LOCAL
// auto begin = std::chrono::high_resolution_clock::now();
// freopen("input.txt", "r", stdin);
// freopen("output.txt", "w", stdout);
// freopen("error.txt", "w", stderr);
// #endif
// ll tc = 1;
// // cin >> tc;
// // for (int t = 0; t < tc; t++) solve(t);
// #ifdef LOCAL
// auto end = std::chrono::high_resolution_clock::now();
// auto elapsed = std::chrono::duration_cast<std::chrono::nanoseconds>(end - begin);
// // cerr << "Time measured: " << elapsed.count() * 1e-9 << " seconds.\n";
// #endif
// }