#include "combo.h"
#include <bits/stdc++.h>
#define pb push_back
using namespace std;
string guess_sequence(int N) {
int c;
char v0;
c = press("AB");
if (c) {
c = press("B");
if (c) v0 = 'B'; else v0 = 'A';
} else{
c = press("X");
if (c) {
v0 = 'X';
} else {
v0 = 'Y';
}
}
vector <char> v;
if (v0 != 'A') v.pb('A');
if (v0 != 'B') v.pb('B');
if (v0 != 'Y') v.pb('Y');
if (v0 != 'X') v.pb('X');
string S = string(1,v0);
for (int i = 1; i <= N-2; i++) {
string NS = S+v[0]+v[0]+S+v[0]+v[1]+S+v[0]+v[2]+S+v[1];
c = press(NS);
if (c == i+1) {
S = S + v[1];
} else if (c == i+2) {
S = S+ v[0];
} else {
S = S + v[2];
}
}
if (N > 1) {
string NS = S + v[0] + S+v[1];
if (press(NS)==N) {
NS = S+v[0];
if (press(NS)==N) {
S = S + v[0];
} else {
S = S+v[1];
}
} else {
S = S+v[2];
}
}
return S;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |