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="";
if(press(tab[1]+tab[0])!=0)
{
if(press(tab[0])==1)
c=0;
else
c=1;
}
else
{
if(press(tab[2])==1)
c=2;
else
c=3;
}
ans+=tab[c];
string ntab[3];
for(int x=0;x<4;x++)
{
if(x!=c)
{
ntab[c1]=tab[x];
c1++;
}
}
if(n==1)return ans;
int ca=0;
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];
ca=press(cur);
if(ca==y)
ans+=ntab[0];
else if(ca==y+1)
ans+=ntab[2];
else
ans+=ntab[1];
}
if(press(ans+ntab[0])==n)
ans+=ntab[0];
else if(press(ans+ntab[1])==n)
ans+=ntab[1];
else
ans+=ntab[2];
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |