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;
if(N==1) {
if(press("A")) return "A";
if(press("B")) return "B";
if(press("X")) return "X";
return "Y";
}
int x = press("AB");
if(x==2) {
S="A";
v={'B','X','Y'};
} else if(x==1) {
S="B";
v={'A','X','Y'};
} else {
if(press("X")) {
S="X";
v = {'A','B','Y'};
} else {
S="Y";
v = {'A','B','X'};
}
}
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]);
}
}
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... |