#include "combo.h"
#include <bits/stdc++.h>
using namespace std;
int press (string p);
string guess_sequence(int n) {
srand(time(nullptr));
vector<int> ord = {0, 1, 2};
string s = "";
string chars;
{
if (press("A")) { s = "A"; chars = "BXY"; }
else if (press("B")) { s = "B"; chars = "AXY"; }
else if (press("X")) { s = "X"; chars = "ABY"; }
else { s = "Y"; chars = "ABX"; }
}
for (int i = 1; i < n; i++) {
random_shuffle(ord.begin(), ord.end());
int x;
if (i == n - 1) {
x = press(s + chars[0]);
if (x == n) { s += chars[0]; break; }
x = press(s + chars[1]);
if (x == n) { s += chars[1]; break; }
s += chars[2]; break;
}
char c0 = chars[ord[0]];
char c1 = chars[ord[1]];
char c2 = chars[ord[2]];
string p = s + c0 + c0 + s + c0 + c1 + s + c0 + c2 + s + c1;
x = press(p);
if (x == i + 2) s += c0;
if (x == i + 1) s += c1;
if (x == i + 0) s += c2;
}
return s;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |