#include <bits/stdc++.h>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <string>
#include "combo.h"
using namespace std;
typedef long long ll;
string guess_sequence(int N) {
string S, p;
ll cont = N-3;
S = "";
if(N == 1){
if(press("A")){return "A";}
if(press("B")){return "B";}
if(press("X")){return "X";}
if(press("Y")){return "Y";}
}
char F;
ll k1 = press("ABX");
if(k1 == 0){
F = 'Y';
S += 'Y';
cont++;
}
if(k1 == 3){
F = 'A';
S += 'A';
cont++;
}
if(k1 == 2){
ll k2 = press("AB");
if(k2 == 1){
F = 'B';
S += "BX";
}
if(k2 == 2){
F = 'A';
S += "AB";
}
}
if(k1 == 1){
ll k2 = press("AXB");
if(k2 == 3){
F = 'A';
S += "AX";
}
if(k2 == 1){
ll k3 = press("XA");
if(k3 == 0){
F = 'B';
S += "BA";
}
if(k3 == 2){
F = 'X';
S += "XA";
}
}
if(k2 == 2){
ll k3 = press("AX");
if(k3 == 1){
F = 'X';
S += "XB";
}
if(k2 == 2){
F = 'A';
S += "AX";
}
}
}
string c = "";
if(F != 'A'){
c += 'A';
}
if(F != 'B'){
c += 'B';
}
if(F != 'X'){
c += 'X';
}
if(F != 'Y'){
c += 'Y';
}
for(ll i=0;i<cont;i++){
p = S + c[0] + S + c[1] + c[0] + S + c[1] + c[1] + S + c[1] + c[2];
//cout<<p<<endl;
//cout<<"meow"<<endl;
ll k = press(p);
if(k == S.size()){
S += c[2];
}
if(k == S.size() + 1){
S += c[0];
}
if(k == S.size() + 2){
S += c[1];
}
}
p = S + c[0] + S + c[1];
ll k = press(p);
if(k == N){
if(press(S + c[0]) == N){S += c[0];}
else{S += c[1];}
} else {
S += c[2];
}
//cout<<S<<endl;
return S;
}
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |