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>
#include "combo.h"
using namespace std;
string guess_sequence(int n)
{
string tab[4]={"A","B","X","Y"};
int c=0,c1=0;
string ans="";
for(int x=0;x<3;x++)
{
if(press(tab[x])==1)
{
c=x;
break;
}
if(c==0 && x==2)
c=x+1;
}
ans+=tab[c];
string ntab[3];
for(int x=0;x<4;x++)
{
if(x!=c)
{
ntab[c1]=tab[x];
c1++;
}
}
for(int y=1;y<n-1;y++)
{
string cur=ans+ntab[2]+ans+ntab[1]+ntab[1]+ans+ntab[1]+ntab[2]+ans+ntab[1]+ntab[0];
int ca=press(cur);
if(ca==y)
ans+=ntab[0];
else if(ca==y+1)
ans+=ntab[0];
else
ans+=ntab[2];
}
if(press(ans+ntab[0])==n)
ans+=ntab[0];
else if(press(ans+ntab[1])==n)
ans+=ntab[1];
else if(press(ans+ntab[2])==n)
ans+=ntab[2];
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |