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<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define rep2(i,l,r) for(int i=(l); i<(r); i++)
#define all(x) x.begin(),x.end()
using ll=long long;
constexpr ll LINF=(1LL<<62)-(1LL<<31);
#include "combo.h"
std::string guess_sequence(int N) {
char fir;
if(press("AB")){
if(press("A")){
fir='A';
}
else{
fir='B';
}
}
else{
if(press("X")){
fir='X';
}
else{
fir='Y';
}
}
string S="";
S+=fir;
vector<string> use;
for(string i:{"A","B","X","Y"}){
if(i!=S)use.emplace_back(i);
}
if(N==1)return S;
rep(i,N-2){
string now=S+use[0]+S+use[1]+use[0]+S+use[1]+use[1]+S+use[1]+use[2];
int coin=press(now);
if(coin==i+1){
S+=use[2];
}
else if(coin==i+2){
S+=use[0];
}
else{
S+=use[1];
}
}
if(press(S+use[1])==N){
S+=use[1];
}
else{
if(press(S+use[2])==N){
S+=use[2];
}
else{
S+=use[0];
}
}
return S;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |