# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1248077 | exoworldgd | Combo (IOI18_combo) | C++20 | 0 ms | 0 KiB |
#pragma GCC optimize("O3")
#pragma GCC target("avx2,bmi,bmi2,popcnt,lzcnt")
#include <bits/stdc++.h>
#include <combo.h>
#define exoworldgd cin.tie(0)->sync_with_stdio(0),cout.tie(0)
#define int long long
using namespace std;
int press(string s);
int ask(string s) {return press(s);}
string guess_sequence(int n) {
string res= "";
char c[4] = {'A','B','X','Y'},first;
if (ask("A") > 0) first = 'A';
else if (ask("B") > 0) first = 'B';
else if (ask("X") > 0) first = 'X';
else first = 'Y';
res += first;
vector<char> ch;
for (char chr : c) if (chr != first) ch.push_back(chr);
for (int i = 1; i< n; i ++) {
bool yes = 0;
for (int j =0 ; j < 2 && !yes; j++) {
string temp = res + ch[j];
if (ask(temp) == i+1) res += ch[i], yes = 1;
}
if (!yes) res += ch[2];
}
return res;
}