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;
int n,num;
char s[3];
string a,b,x,y,ans,test,one,two;
std::string guess_sequence(int N) {
n=N;
one.push_back('A');
one.push_back('B');
two.push_back('X');
two.push_back('Y');
if(press(one)!=0)
{
a.push_back('A');
if(press(a)!=0)
{
ans.push_back('A');
s[0]='B';
s[1]='X';
s[2]='Y';
}else
{
ans.push_back('B');
s[0]='A';
s[1]='X';
s[2]='Y';
}
}else
{
x.push_back('X');
if(press(x)!=0)
{
ans.push_back('X');
s[0]='A';
s[1]='B';
s[2]='Y';
}else
{
ans.push_back('Y');
s[0]='A';
s[1]='B';
s[2]='X';
}
}
if(n!=1)
{
for(int i=1;i<n-1;i++)
{
test+=(ans);
test.push_back(s[0]);
test+=(ans);
test.push_back(s[1]);
test.push_back(s[0]);
test+=(ans);
test.push_back(s[1]);
test.push_back(s[1]);
test+=(ans);
test.push_back(s[1]);
test.push_back(s[2]);
num=press(test);
if(num==i+2)
{
ans.push_back(s[1]);
}else if(num==i+1)
{
ans.push_back(s[0]);
}else
{
ans.push_back(s[2]);
}
test.clear();
}
test+=(ans);
test.push_back(s[0]);
if(press(test)==n)
{
ans.push_back(s[0]);
}else
{
test.clear();
test+=(ans);
test.push_back(s[1]);
if(press(test)==n)
{
ans.push_back(s[1]);
}else
{
ans.push_back(s[2]);
}
}
}
return ans;
}
//2240 char
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |