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) {
/*std::string p = "";
for (int i = 0; i < 4 * N; ++i) {
p += 'A';
}
int coins = press(p);
std::string S = "";
for (int i = 0; i < N; ++i) {
S += 'A';
}*/
string answ, left;
int coins;
if (press("AB")) {
if (press("A")) {
answ = "A";
left = "BXY";
} else {
answ = "B";
left = "AXY";
}
} else if (press("X")) {
answ = "X";
left = "ABY";
} else {
answ = "Y";
left = "ABX";
}
if (N == 1) return answ;
for (int i = 1; i < N-1; i++) {
coins = press(answ + left[0] + left[0] + answ + left[0] + left[1] + answ + left[0] + left[2] + answ + left[1]);
if (coins == i + 2) {
answ += left[0];
} else if (coins == i+1) {
answ += left[1];
} else {
answ += left[2];
}
}
if(press(answ + left[0] + answ + left[1]) == N) {
if (press(answ + left[0]) == N) {
answ += left[0];
} else {
answ += left[1];
}
} else {
answ += left[2];
}
return answ;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |