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 f;
string s;
if(press("AB"))
{
if(press("A")) f="A",s="BXY";
else f="B",s="AXY";
}
else
{
if(press("X")) f="X",s="ABY";
else f="Y",s="ABX";
}
string ans;
ans+=f;
if(n==1) return ans;
for(int i=2;i<n;i++)
{
string p=ans+s[0]+ans+s[1]+s[0]+ans+s[1]+s[1]+ans+s[1]+s[2];
int get=press(p);
if(get==i-1) ans+=s[2];
else if(get==i) ans+=s[0];
else ans+=s[1];
}
if(press(ans+s[0])==n) ans+=s[0];
else if(press(ans+s[1])==n) 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... |