#include <iostream>
#include <cstdio>
#include <vector>
#include <array>
#include <string>
#include <algorithm>
#include <numeric>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <queue>
#include <cmath>
#include <climits>
#include <iomanip>
#include <limits>
#include <tuple>
#include <stack>
#include <bitset>
#include <cstring>
#include <sstream>
#include <functional>
#include <random>
#include "combo.h"
using namespace std;
string guess_sequence(int N) {
string ans(N, '?');
for (char c : {'A', 'B', 'X', 'Y'})
if (press(string(1, c))) {
ans += c;
break;
}
char p[3];
int k = 0;
for (char c : {'A', 'B', 'X', 'Y'})
if (c != ans[0])
p[k++] = c;
for (int i = 1; i < N; i += 2) {
string ask = ans + p[0] + ans + p[1] + p[0] + ans + p[1] + p[1] + ans + p[1] + p[2];
int q = press(ask);
if (q == 3)
ans[i] = p[1];
else if (q == 2)
ans[i] = p[0];
else
ans[i] = p[2];
}
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |