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 = "";
for(char c : "ABX") {
int p = press(string(1, c));
if(p == 1) {
S.push_back(c);
break;
}
}
if(S == "") S = "Y";
string B = "ABXY";
B.erase(B.find(S), 1);
for(int i = 1; i < N-1; ++i) {
string guess = S + B[0] +
(S + B[1] + B[0]) +
(S + B[1] + B[1]) +
(S + B[1] + B[2]);
int p = press(guess);
if(p == 0) S.push_back(B[2]);
if(p == 1) S.push_back(B[0]);
if(p == 2) S.push_back(B[1]);
}
for(char c : B) {
int p = press(S + c);
if(p == N) {
S.push_back(c);
break;
}
}
return S;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |