#include "combo.h"
#include <unordered_set>
#include <unordered_map>
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <string>
#include <iomanip>
#include <numeric>
using namespace std;
#define INF 1000000000
using ll = long long;
std::string guess_sequence(int N) {
  string S = "";
  vector<char> btns = {'A','B','X','Y'};
  while (S.length() != N) {
    if (S.length() == 0) {
        int coin = press("AB");
        if (coin > 0) {
            string s;
            s += 'A';
            coin = press(s);
            if (coin == 1) {
                S += 'A';
                btns.erase(btns.begin());
            } else {
                S +=  'B';
                btns.erase(btns.begin()+1);
            }
        } else {
            string s;
            s += 'X';
            coin = press(s);
            if (coin == 1) {
                S += 'X';
                btns.erase(btns.begin()+2);
            } else {
                S +=  'Y';
                btns.erase(btns.begin()+3);
            }
        }
    } else if (S.length() < N-1) {
        string message = "";
        message += S;
        message += btns[0];
        for (size_t i = 0; i < 3; i++) {
            message += S;
            message += btns[1];
            message += btns[i];
        }
        int coin = press(message);
        if (coin == S.length()+1) {
            S += btns[0];
        } else if (coin == S.length() + 2) {
            S += btns[1];
        } else {
            S += btns[2];
        }
    }
    else {
        string ms = S+btns[0]+btns[1]+S+btns[1]+btns[0];
        int coin = press(ms);
        if (coin > S.length()) {
            coin = press(S+btns[0]);
            if (coin == 1) {
                S += btns[0];
            } else {
                S += btns[1];
            }
        } else {
            S += btns[2];
        }
    }
  }
  return S;
}
| # | Verdict | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict | Execution time | Memory | Grader output | 
|---|
| Fetching results... |