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 <iostream>
using namespace std;
string guess_sequence(int N) {
string p = "",S = "";
char t;
int coins;
p="AB";
coins = press(p);
if(coins>=1)
{
p="A";
coins = press(p);
if(coins==1)
{
S="A";
t=1;
}
else
{
S="B";
t=2;
}
}
else
{
p="X";
coins = press(p);
if(coins==1)
{
S="X";
t=3;
}
else
{
S="Y";
t=4;
}
}
if(N==1)return S;
///cout<<S<<endl;
char a,b,c;
if(t==1){a='B',b='X',c='Y';}
if(t==2){a='A',b='X',c='Y';}
if(t==3){a='A',b='B',c='Y';}
if(t==4){a='A',b='B',c='X';}
for(int i=2;i<N;i++)
{
string tmp=S;
p=tmp+a;
p+=tmp+b+a;
p+=tmp+b+b;
p+=tmp+b+c;
//cout<<tmp<<" "<<a<<" "<<b<<" "<<c<<endl;
coins = press(p);
if(coins==i-1)S+=c;
if(coins==i)S+=a;
if(coins==i+1)S+=b;
//cout<<S<<endl;
}
p=S+a+S+b;
coins = press(p);
if(coins==N)
{
p=S+a;
coins = press(p);
if(coins==N)S+=a;
else S+=b;
}
else S+=c;
return S;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |