#include "combo.h"
#include <bits/stdc++.h>
using namespace std;
string guess_sequence(int N) {
string ans = "";
string button = "ABXY";
int t = press("AB");
if (t == 0)
{
t = press("X");
if (t == 0) ans = "Y", button = "ABX";
else ans = "X", button = "ABY";
}
else
{
t = press("A");
if (t == 0) ans = "B", button = "AXY";
else ans = "A", button = "BXY";
}
for (int i=1; i<N-1; i++)
{
t = press(ans+button[0]+ans+button[1]+button[0]+ans+button[1]+button[1]+ans+button[1]+button[2]);
if (t == ans.length()+1) ans += button[0];
else if (t == ans.length()+2) ans += button[1];
else ans += button[2];
}
for (int i=0; i<2; i++)
{
t = press(ans+button[i]);
if (t == ans.length()+1)
{
ans += button[i];
break;
}
}
if (t == 0) ans += button[2];
return ans;
}
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |