This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#pragma GCC optimize("O3")
#include "combo.h"
#include<bits/stdc++.h>
#define rc(x) return cout<<x<<endl,0
#define pb push_back
#define in insert
#define er erase
#define fd find
#define fr first
#define sc second
typedef long long ll;
typedef long double ld;
const ll INF=0x3f3f3f3f3f3f3f3f;
const ll llinf=(1LL<<62);
const int inf=(1<<30);
const int nmax=1e5+50;
const int mod=1e9+7;
using namespace std;
string guess_sequence(int n)
{
int x;
string s,p,t="ABXY",v;
char ch;
x=press("AB");
if(x==1)
{
x=press("A");
if(x==0)s+="B",ch='B';
else s+="A",ch='A';
}
else if(x==2)s+="A",ch='A';
else
{
x=press("X");
if(x==0)s+="Y",ch='Y';
else s+="X",ch='X';
}
if(n==1)return s;
for(int i=0;i<4;i++)
{
if(t[i]==ch)
{
for(int j=0;j<i;j++)v+=t[j];
for(int j=i+1;j<4;j++)v+=t[j];
break;
}
}
for(int i=2;i<n;i++)
{
p=s+v[0]+s+v[1]+v[0]+s+v[1]+v[1]+s+v[1]+v[2];
x=press(p);
if(x==(int)s.size())s+=v[2];
else if(x==(int)s.size()+1)s+=v[0];
else s+=v[1];
}
x=press(s+v[0]);
if(x==n)s+=v[0];
else
{
x=press(s+v[1]);
if(x==n)s+=v[1];
else s+=v[2];
}
return s;
}
/*int main()
{
//freopen("sol.in","r",stdin);
//freopen("sol.out","w",stdout);
ios_base::sync_with_stdio(false);cin.tie(0);cerr.tie(0);cout.tie(0);
return 0;
}*/
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |