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"
using namespace std;
string guess_sequence(int N)
{
string curSeq;
string aPresse;
string dispo;
if(press("AB") >= 1)
{
if(press("A") == 1)
{
curSeq = "A";
dispo = "BXY";
}
else
{
curSeq = "B";
dispo = "AXY";
}
}
else
{
if(press("X") == 1)
{
curSeq = "X";
dispo = "ABY";
}
else
{
curSeq = "Y";
dispo = "ABX";
}
}
for(int i = 0; i < N - 2; i++)
{
for(int j = 0; j < 3; j++)
{
aPresse += curSeq;
aPresse += dispo[0];
aPresse += dispo[j];
}
aPresse += curSeq;
aPresse += dispo[1];
int score = press(aPresse);
if(score == i + 3)
{
curSeq += dispo[0];
}
else if(score == i + 2)
{
curSeq += dispo[1];
}
else
{
curSeq += dispo[2];
}
aPresse.clear();
}
aPresse += curSeq;
aPresse += dispo[0];
aPresse += curSeq;
aPresse += dispo[1];
if(press(aPresse) == N)
{
aPresse.clear();
aPresse += curSeq;
aPresse += dispo[0];
if(press(aPresse) == N)
{
curSeq += dispo[0];
}
else
{
curSeq += dispo[1];
}
}
else
{
curSeq += dispo[2];
}
return curSeq;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |