# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
933845 | emad234 | 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>
#define ll long long
#define F first
#define S second
#define pii pair<int,int>
const int mod = 1e9 + 7;
const int mxN = 2e5 + 5;
using namespace std;
string guess_sequence(int N) {
string s = "";
int x = press("XY");
if(x == 2) s += "XY";
else if(x == 1){
if(press("X") == 1) s += "X";
else s += "Y";
}else{
if(press("A") == 1) s += "A";
else s += "B";
}
string a = "A",b = "B",c = "X";
char a1 = 'A',b1 = 'B',c1 = 'X';
if(s[0] == a1) a = "Y";
if(s[0] == b1) b = "Y";
if(s[0] == c1) c = "Y";
for(int i = s.size();i < N;i++){
if(i == N - 1){
int x = press(s + a + s + b);
if(x == s.size() + 1){
if(press(s + a) == s.size() + 1) s += a;
else s += b;
}
else s += c;
break;
}
string S = s + a + s + b + a + s + b + b + s + b + c;
cout<<S<<'\n';
x = press(S);
if(x == s.size()) {
s += c;
}
else if(x == s.size() + 1) s += a;
else s += b;
}
return s;
}