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;
char val[10];
std::string guess_sequence(int N) {
string AB = "AB";
string AX = "AX";
int ab = press(AB);
int ax = press(AX);
string ans = "";
char st = 0;
if(ab&&ax){
ans = "A";
st = 'A';
val[0] = 'B';
val[1] = 'X';
val[2] = 'Y';
}
else if(ab){
ans = "B";
st = 'B';
val[0] = 'A';
val[1] = 'X';
val[2] = 'Y';
}
else if(ax){
ans = "X";
st = 'X';
val[0] = 'A';
val[1] = 'B';
val[2] = 'Y';
}
else {
ans = "Y";
st = 'Y';
val[0] = 'A';
val[1] = 'B';
val[2] = 'X';
}
string tz = "";
string to = "";
string tt = "";
string oz = "";
tz += val[2];
tz += val[0];
to += val[2];
to += val[1];
tt += val[2];
tt += val[2];
oz += val[1];
oz += st;
for(int i=1;i<N-1;i++){
string curs = ans+tz;
curs+=(ans+to);
curs+=(ans+tt);
curs+=(ans+oz);
int curv = press(curs);
assert(curv<=i+2);
ans+=val[curv-i];
}
string ansz = ans+val[0];
string anso = ans+val[1];
if(press(ansz)==N){
ans+=val[0];
}
else if(press(anso)==N){
ans+=val[1];
}
else {
ans+=val[2];
}
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |