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;
string guess_sequence(int N)
{
string s="ABXY",ans;
if(press("AB"))
{
if(press("A"))
{
ans+='A';
s="BXY";
}
else
{
ans+='B';
s="AXY";
}
}
else
{
if(press("X"))
{
ans+='X';
s="ABY";
}
else
{
ans+='Y';
s="ABX";
}
}
for(int i=2; i<=N; i++)
{
if(i==N)
{
string ask=ans+s[0],ask1=ans+s[1];
if(press(ask)==N)ans=ask;
else if(press(ask1)==N)ans=ask1;
else ans+=s[2];
break;
}
string ask;
ask+=ans;
ask+=s[0];
ask+=ans;
ask+=s[1];
ask+=s[1];
ask+=ans;
ask+=s[1];
ask+=s[0];
ask+=ans;
ask+=s[1];
ask+=s[2];
int k=press(ask);
if(k==i)ans+=s[0];
else if(k==i+1)ans+=s[1];
else ans+=s[2];
}
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |