#include "combo.h"
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
using vi = vector<int>;
using pi = pair<int,int>;
string guess_sequence(int N) {
string ans = "Y";
int tmp = press("A");
if(tmp) ans = "A";
else if(press("B")) ans = "B";
else if(press("X")) ans = "X";
vector<char>c({'A', 'B', 'X', 'Y'});
for(int i=0; i<4; ++i) {
if(c[i] == ans[0]) {
c.erase(c.begin()+i);
break;
}
}
if(N == 1) return ans;
for(int i=1; i<N-1; ++i) {
string nw = ans + c[0] + c[0] + ans + c[0] + c[1] + ans + c[0] + c[2] + ans + c[1];
tmp = press(nw);
int len = (int)ans.length();
if(tmp == len+1) ans += c[1];
else if(tmp == len+2) ans += c[0];
else ans += c[2];
}
for(char ch: c) {
string nw = ans+ch;
if(press(nw) == N) {
ans += ch;
break;
}
}
return ans;
}
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |