This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
#include "combo.h"
#define ll long long int
#define mp make_pair
#define pb push_back
#define ld long double
#define pii pair<int,int>
#define sz(x) (int)x.size()
#define piii pair<pii,pii>
#define precise cout<<fixed<<setprecision(10)
#define st first
#define nd second
#define ins insert
#define vi vector<int>
#define BOOST ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
using namespace std;
const char lit[4]={'X','Y','A','B'};
string guess_sequence(int n)
{
string ans="";
char first;
int ile1=press("XY");
if (ile1)
{
if (press("X"))first='X';
else first='Y';
}
else
{
if (press("A"))first='A';
else first='B';
}
ans+=first;
if (n==1)return ans;
vector<char>unused;
unused.clear();
for (int i=0;i<4;i++)if (lit[i]!=first)unused.pb(lit[i]);
for (int i=1;i<=n-2;i++)
{
int news=press(ans+unused[0]+ans+unused[1]+unused[0]+ans+unused[1]+unused[1]+ans
+unused[1]+unused[2]);
if (news==sz(ans)+1)ans+=unused[0];
else if (news==sz(ans)+2)ans+=unused[1];
else ans+=unused[2];
}
if (press(ans+unused[0]+ans+unused[1])==n)
{
if (press(ans+unused[0])==n)ans+=unused[0];
else ans+=unused[1];
}
else ans+=unused[2];
return ans;
}
/*
int32_t main()
{
BOOST;
return 0;
}
*/
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |