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;
vector<char>Y={'A','B','X','Y'};
void usun(int u)
{
swap(Y[u],Y[Y.size()-1]);
Y.pop_back();
}
string guess_sequence(int n)
{
string odp;
if(press("AB")==0)
{
if(press("X")==0)
{///y
odp.push_back('Y');
usun(3);
}
else
{///x
odp.push_back('X');
usun(2);
}
}
else
{
if(press("A")==0)
{///b
odp.push_back('B');
usun(1);
}
else
{///a
odp.push_back('A');
usun(0);
}
}
for(int i=2;i<n;i++)
{
string zap;
zap+=odp;
zap.push_back(Y[0]);
zap.push_back(Y[0]);
zap+=odp;
zap.push_back(Y[0]);
zap.push_back(Y[1]);
zap+=odp;
zap.push_back(Y[0]);
zap.push_back(Y[2]);
zap+=odp;
zap.push_back(Y[1]);
int u=press(zap);
if(u==(int)odp.size()+2)
{
odp.push_back(Y[0]);
}
else if(u==(int)odp.size()+1)
{
odp.push_back(Y[1]);
}
else if(u==(int)odp.size()+0)
{
odp.push_back(Y[2]);
}
}
string zap;
zap+=odp;
zap.push_back(Y[0]);
zap+=odp;
zap.push_back(Y[1]);
if(press(zap)==(int)odp.size())
{
odp.push_back(Y[2]);
}
else
{
zap.clear();
zap+=odp;
zap.push_back(Y[0]);
if(press(zap)==(int)odp.size())
{
odp.push_back(Y[1]);
}
else
{
odp.push_back(Y[0]);
}
}
return odp;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |