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 guess_sequence(int N) {
char pos[4];
pos[0] = 'A';
pos[1] = 'B';
pos[2] = 'X';
pos[3] = 'Y';
string p = "";
p = "AB";
int coins = press(p);
if(coins == 2)
{
p = "A";
}
else if(coins == 1)
{
p = "BX";
coins = press(p);
if(coins > 0)
p = "B";
else
p = "A";
} else if(coins == 0)
{
p = "BX";
coins = press(p);
if(coins == 1)
p = "X";
else
p = "Y";
}
string s = p;
pos[3] = p[0];
if(p == "A")
{
pos[0] = 'Y';
} else if(p == "B")
{
pos[1] = 'Y';
} else if(p == "X")
pos[2] = 'Y';
for(int i = 2; i <= N - 1; i++)
{
p = s + pos[0] + s + pos[2] + pos[0] + s + pos[2] + pos[1] + s + pos[2] + pos[2];
coins = press(p);
if(coins == i)
s += pos[0];
else if(coins == i - 1)
s += pos[1];
else
s += pos[2];
}
if(N > 1) {
p = s + pos[0] + s + pos[1];
coins = press(p);
if(coins == N - 1)
s += pos[2];
else
{
p = s + pos[1] + s + pos[2];
coins = press(p);
if(coins == N)
s += pos[1];
else
s += pos[0];
}
}
//cout << s << "\n";
return s;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |