# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1142365 | FZ_Laabidi | Combo (IOI18_combo) | C++20 | 0 ms | 0 KiB |
#include <bits/stdc++.h>
#include "combo.h"
#define int long long
using namespace std;
int N;
string guess_sequence() {
string P = "";
set<char> tr = {'A', 'B', 'X', 'Y'};
int c = press("AB");
if(c>=1) {
c = press("A");
if (c==1)P+="A";
else P+="B";
}
else if (c==0) {
c = press("X");
if (c==1)P+="X";
else P+="Y";
}
tr.erase(P[0]);
char B, X, Y;
c=0;
for (auto x: tr) {
if (c==0)B = x;
if (c==1)X = x;
if (c==2)Y = x;
c++;
}
for (int i=1; i<=N-2; i++) {
string ty = P+X+P+B+X+P+B+Y+P+B+B;
c = press(ty);
if (c==1)P+=X;
else if (c==2)P+=B;
else P+=Y;
}
string ty= P+X+P+B;
c = press(ty);
if (c==1) {
c = press(P+X);
if (c==1)P+=X;
else P+=B;
}
else P+=Y;
return P;
}
//Cbx-2bx=0
// bx=0;