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<iostream>
#include "combo.h"
using namespace std;
string guess_sequence(int N)
{
int r,poz=0,cnt=-1,n=N;
string a[3],cand[4]={"A","B","X","Y"};
string q,rez;
q="AB";
r=press(q);
if(r)
poz=0;
else
poz=2;
q=cand[poz];
r=press(q);
if(r==0)
poz++;
for(int i=0;i<4;i++)
if(i!=poz)
{
cnt++;
a[cnt]=cand[i];
}
rez=cand[poz];
cnt=1;
poz=2;
for(int i=2;i<n;i++)
{
q=rez+a[0];
q+=rez+a[1]+a[0];
q+=rez+a[1]+a[1];
q+=rez+a[1]+a[2];
r=press(q);
if(r==i-1)
{
rez=rez+a[2];
continue;
}
if(r==i)
{
rez=rez+a[0];
continue;
}
rez=rez+a[1];
}
q=rez+a[0];
q+=rez+a[1];
r=press(q);
if(r==n)
{
q=rez+a[0];
r=press(q);
if(r==n)
rez=rez+a[0];
else
rez=rez+a[1];
}
else
rez=rez+a[2];
return rez;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |