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) {
string p = "A";
vector<char> poss = {'B', 'X', 'Y'};
//if (N == 1) {
if (!press(p)) {
p = "B";
poss = {'A', 'X', 'Y'};
if (!press(p)) {
p = "X";
poss = {'A', 'B', 'Y'};
if (!press(p)) {
p = "Y";
poss = {'A', 'B', 'X'};
}
}
}
/*return p;
}*/
/*p = "BYBXBA";
int res = press(p);
if (res == 1) p = "A";
else if (res == 2) {
p = "B";
poss = {'A', 'X', 'Y'};
}
else {
p = "YBYYAYYX";
res = press(p);
if (res == 1) {
p = "X";
poss = {'A', 'B', 'Y'};
}
else {
p = "Y";
poss = {'A', 'B', 'X'};
}
}*/
for (int i = 1; i < N; i++) {
string test = p;
if (i != N - 1) {
test += poss[0];
test += p;
test += poss[1]; test += poss[0];
test += p;
test += poss[1]; test += poss[1];
test += p;
test += poss[1]; test += poss[2];
int coins = press(test);
if (coins == i + 1) p += poss[0];
else if (coins == i + 2) p += poss[1];
else p += poss[2];
}
else {
test += poss[0];
int res = press(test);
if (res == N) p += poss[0];
else {
test = p; test += poss[1];
res = press(test);
if (res == N) p += poss[1];
else p += poss[2];
}
}
}
return p;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |