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;
vector<string> v;
if(press("A")){
S = "A";
u="BXY";
v={"BB","BX","BY","X"};
}
else if(press("B")){
S = "B";
u="AXY";
v={"AA","AX","AY","X"};
}
else if(press("X")){
S = "X";
u="ABY";
v={"AA","AB","AY","B"};
}
else{
S = "Y";
u="ABX";
v={"AA","AB","AX","B"};
}
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];
//cout << p << "\n";
int coin=press(p)-i;
//cout << coin << "\n";
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 if(press(S+u[2])==N) S+=u[2];
return S;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |