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>
#define PB push_back
using namespace std;
string guess_sequence(int N) {
string moves[4]={"A", "B", "X", "Y"};
string str = "";
string q1="AB", q2="XY";
if(press(q1)){
if(press(moves[0]))str=moves[0];
else str=moves[1];
}else{
if(press(moves[2]))str=moves[2];
else str=moves[3];
}
string S = str, last;
if(N==1)return S;
vector<string>newmoves;
for(int i = 0 ; i < 4 ; i++){
if(moves[i]!=S)newmoves.PB(moves[i]);
}
for (int i = 1; i < N-1; i++) {
string nxt = newmoves[0];
int ans=press(S+newmoves[1]+S+newmoves[2]+newmoves[0]+S+newmoves[2]+newmoves[1]+S+newmoves[2]+newmoves[2]);
if(ans==i+1)S+=newmoves[1];
else if(ans>i+1)S+=newmoves[2];
else S+=nxt;
}
if(press(S+newmoves[0])==N)S+=newmoves[0];
else if(press(S+newmoves[1])==N)S+=newmoves[1];
else S+=newmoves[2];
return S;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |