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;
string guess_sequence(int n) {
string S = "",ch = "ABXY",c = "",s;
int a,b;
a = press("AB");
if (a >= 1) {
b = press("A");
if (b == 1)
S += "A";
else
S += "B";
}
else {
b = press("X");
if (b == 1)
S += "X";
else
S += "Y";
}
if (n == 1)
return S;
for (int i = 0;i < 4;i++){
if (c[i] == S[0])
continue;
ch += c[i];
}
for (int i = 1;i < n - 1;i++){
s = S + ch[0] + ch[0] + S + ch[0] + ch[1] + S + ch[0] + ch[2] + S + ch[1];
b = press(s);
if (b == i)
S += ch[2];
else if (b == i + 1)
S += ch[1];
else
S += ch[0];
}
b = press(S + ch[0]);
if (b == n)
S += ch[0];
else {
a = press(S + ch[1]);
if (a == n)
S += ch[1];
else
S += ch[2];
}
return S;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |