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 comb[4]={'A', 'B', 'X', 'Y'};
string guess_sequence(int N) {
string p = "";
string ans;
p="AB";
if(press(p)>0)
{
p="";
p+='A';
if(press(p)>0) ans+='A';
else ans+='B';
}
else
{
p="X";
if(press(p)>0) ans='X';
else ans='Y';
}
if(N==1) return ans;
string hehe="";
for(int i=0;i<4;i++)
{
if(comb[i]!=ans[0]) hehe+=comb[i];
}
for(int i=1;i<N-1;i++)
{
p="";
for(int j=0;j<3;j++)
{
p+=ans;
p+=hehe[0];
p+=hehe[j];
}
p+=ans;
p+=hehe[1];
p+=ans[0];
int res=press(p);
if(res==i+2) ans+=hehe[0];
else if(res==i+1) ans+=hehe[1];
else ans+=hehe[2];
}
p="";
p+=ans;
p+=hehe[0];
p+=ans;
p+=hehe[1];
if(press(p)!=N) ans+=hehe[2];
else
{
p="";
p+=ans;
p+=hehe[0];
if(press(p)==N) ans+=hehe[0];
else ans+=hehe[1];
}
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |