#include "combo.h"
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define sz(x) (int) (x).size()
#define endl '\n'
string guess_sequence(int N)
{
string ans="";
string c="ABXY";
if(press("AB"))
{
if(press("A"))
{
c.erase('A');
ans='A';
}
else
{
c.erase('B');
ans='B';
}
}
else
{
if(press("X"))
{
c.erase('X');
ans='X';
}
else
{
c.erase('Y');
ans='Y';
}
}
if(N==1) return ans;
for(int i = 1;i < N-1;i++)
{
string ask=ans+c[0]+c[0]+ans+c[0]+c[1]+ans+c[0]+c[2]+ans+c[1];
int len=press(ask);
if(len==i) ans+=c[2];
else if(len==i+1)ans+=c[1];
else ans+=c[0];
}
if(press(ans+"AB"))
{
if(press(ans+"A"))
{
ans+='A';
}
else
{
ans+='B';
}
}
else
{
if(press(ans+"X"))
{
ans+='X';
}
else
{
c.erase('Y');
ans+='Y';
}
}
return ans;
}
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |