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;
string Btns[] = {"A","B","X","Y"};
string guess_sequence(int N) {
string s = "";
int p = -1;
if (press(Btns[0] + Btns[1]) > 0) {
if (press(Btns[0]) > 0)
{
s += Btns[0];
if (p <= -1) p = 0;
}
else if (press(Btns[1]) > 0)
{
s += Btns[1];
if (p <= -1) p = 1;
}
}
else
{
if (press(Btns[2]) > 0)
{
s += Btns[0];
if (p <= -1) p = 2;
}
else if (press(Btns[3]) > 0)
{
s += Btns[1];
if (p <= -1) p = 3;
}
}
if(N == 1)
{
return s;
}
int last_one = 0;
for(int i = 2;i < N - 1;i++)
{
bool fact = false;
if (press(s + Btns[last_one]) == i)
{
s += Btns[last_one];
fact = true;
}
else if (fact == false)
{
for(int j = 0;j <= 3;j++)
{
if(j != p && !fact)
{
if(press(s + Btns[j]) == i)
{
s += Btns[j];
fact = true;
last_one = j;
break;
}
}
}
}
}
return s;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |