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;
std::string guess_sequence(int N) {
string S,u;
if(press("AB")!=0){
if(press("A")==1){
S = "A";
u="BXY";
}
else{
S = "B";
u="AXY";
}
}
else{
if(press("X")==1){
S = "X";
u="ABY";
}
else{
S = "Y";
u="ABX";
}
}
if(N==1) return S;
string p(N*4,S[0]);
for(int i=1;i<N-1;i++){
p[i]=u[0];
p[i+1]=u[0];
p[N+i]=u[0];
p[N+i+1]=u[1];
p[2*N+i]=u[0];
p[2*N+i+1]=u[2];
p[3*N+i]=u[1];
int coin=press(p)-i;
p[i]=u[2-coin];
p[N+i]=u[2-coin];
p[2*N+i]=u[2-coin];
p[3*N+i]=u[2-coin];
S+=u[2-coin];
}
if(press(S+u[0])==N) S+=u[0];
else if(press(S+u[1])==N) S+=u[1];
else S+=u[2];
return S;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |