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"
using namespace std;
typedef long long ll;
const int maxn=1e6+7;
const int inf=INT_MAX;
const ll inff=1e18;
const ll mod=1e9+7;
#define pii pair<int,int>
#define mkp make_pair
#define F first
#define S second
#define pb push_back
#define sz(v) ((int)(v).size())
#define all(v) (v).begin(),(v).end()
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
//#define int ll
//#define endl '\n'
string s="ABXY";
string rest;
string ans;
string guess_sequence(int n)
{
int ret=press("AB");
if (ret>0)
{
ret=press("A");
if (ret>0) ans+="A";
else ans+="B";
}
else
{
ret=press("X");
if (ret>0) ans+="X";
else ans+="Y";
}
if (n==1)
{
return ans;
}
for (char c:s)
{
if (c!=ans[0]) rest+=c;
}
for (int i=2;i<=n-1;i++)
{
ret=press(ans+rest[1]+ans+rest[2]+rest[0]+ans+rest[2]+rest[1]+ans+rest[2]+rest[2]);
if (ret==i-1) ans+=rest[0];
else if (ret==i) ans+=rest[1];
else ans+=rest[2];
}
for (int i=0;i<2;i++)
{
ret=press(ans+rest[i]);
if (ret==n) return ans+rest[i];
}
return ans+rest[2];
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |