# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1007223 | devariaota | 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;
string s,ans,coba;
int n;
string guess_sequence(int N) {
n = N;
for (int i=1; i<=n; i++) {
if (i == 1) {
coba = "AB";
int x = press(coba);
if (x == 0) {
coba = "X";
int y = press(coba);
if (y == 1) {
ans+="X";
} else {
ans+="Y";
}
} else {
coba = "A";
int y = press(coba);
if (y == 1) {
ans+="A";
} else {
ans+="B";
}
}
} else {
coba = ans + "B" + ans + "XB" + ans + "XX" + ans + "XY";
int x = press(coba);
if (x == i) {
ans += "B";
} else if (x == i + 1) {
ans += "X";
} else {
ans += "Y";
}
}
}
return ans;
}