# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
503944 | TranGiaHuy1508 | Combo (IOI18_combo) | C++17 | 0 ms | 0 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL
int press(string p){
cout << p << "\n";
fflush(stdout);
int r; cin >> r; return r;
}
#endif
string ch = "ABXY";
string guess_sequence(int n){
string prefix = "";
string other;
if (press("AABB")){
if (press("AA")){
prefix = "A";
other = "BXY";
}
else{
prefix = "B";
other = "AXY";
}
}
else{
if (press("XX")){
prefix = "X";
other = "ABY";
}
else{
prefix = "Y";
other = "ABX";
}
}
for (int i=2; i<=n; i++){
string c = prefix + other[0] + prefix + other[1];
if (press(c) > (int)prefix.length()){
string d = prefix + other[0];
if (press(d) > (int)prefix.length()){
prefix += other[0];
}
else{
prefix += other[1];
}
}
else{
prefix += other[2];
}
}
return prefix;
}
#ifdef LOCAL
int main(){
int n; cin >> n;
cout << guess_sequence(n);
}
#endif