이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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... |