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 "combo.h"
#include <bits/stdc++.h>
using namespace std;
string guess_sequence(int N) {
vector<char> v;
string S;
int x = press("AB");
if(x) {
if(press("A")) {
S="A";
v={'B','X','Y'};
} else {
S="B";
v={'A','X','Y'};
}
} else {
if(press("X")) {
S="X";
v = {'A','B','Y'};
} else {
S="Y";
v = {'A','B','X'};
}
}
cerr << S << endl;
for(int i = 1; i < N-1; i++) {
string t;
t += S;
t.push_back(v[0]);
t += S;
t.push_back(v[1]);
t.push_back(v[0]);
t += S;
t.push_back(v[1]);
t.push_back(v[1]);
t += S;
t.push_back(v[1]);
t.push_back(v[2]);
int x = press(t);
if(x==i) {
S.push_back(v[2]);
} else if(x==i+1) {
S.push_back(v[0]);
} else {
S.push_back(v[1]);
}
}
if(N > 1) {
string t;
t = S;
t.push_back(v[0]);
if(press(t) == N)
return t;
t = S;
t.push_back(v[1]);
if(press(t) == N)
return t;
t = S;
t.push_back(v[2]);
// if(press(t) == N)
return t;
}
return S;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |