#include "combo.h"
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define ll long long
string guess_sequence(int N) {
vector<char> a = {'A', 'B', 'X', 'Y'};
string s = "";
for(int i = 0; i < 4; ++i){
s += a[i];
if(press(s) == 1){
break;
}
else s = "";
}
vector<char> b;
for(int i = 0; i < 4; ++i){
if(a[i] != s[0]){
b.pb(a[i]);
}
}
vector<string> vs;
sort(begin(b), end(b));
do{
string st = "";
for(int i = 0; i < 3; ++i){
st += b[i];
}
vs.pb(st);
}
while(next_permutation(begin(b), end(b)));
ll cnt = 1;
while(cnt != N){
if(cnt + 3 <= N){
for(auto &x : vs){
if(press(s + x) == cnt + 3){
s += x;
cnt += 3;
break;
}
}
}
else{
for(int i = 0; i < 3; ++i){
if(press(s + b[i]) == cnt + 1){
s += a[i];
cnt++;
break;
}
}
}
}
return s;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |