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 res = "";
string s="AB";
if(press(s)>0)
{
s="A";
if(press(s)>0) res+='A';
else res+='B';
}
else
{
s="X";
if(press(s)>0)res+='X';
else res+='Y';
}
vector<char>a;
if(res[0]!='A')a.push_back('A');
if(res[0]!='B')a.push_back('B');
if(res[0]!='X')a.push_back('X');
if(res[0]!='Y')a.push_back('Y');
for(int i=1;i<=N-2;i++)
{
string temp="";
for(int j=0;j<=2;j++)
{
temp+=res;
temp+=a[0];
temp+=a[j];
}
temp+=res;
temp+=a[1];
int x=press(temp);
if(x==i) res+=a[2];
else if(x==i+1) res+=a[1];
else res+=a[0];
}
if(N>1)
{
string temp=res;
temp+=a[0];
if(press(temp)==N)
{
res+=a[0];
}
else
{
temp=res;
temp+=a[1];
if(press(temp)==N)
{
res+=a[1];
}
else res+=a[2];
}
}
//cout<<res<<endl;
return res;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |