# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
925935 | HuyQuang_re_Zero | Combo (IOI18_combo) | C++14 | 0 ms | 0 KiB |
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>
#define ll long long
#define db long double
#define N 505
#define II pair <ll,ll>
#define III pair <ll,II>
#define IV pair <vector <int>,vector <int> >
#define IDB pair <db,int>
#define TII pair <treap*,treap*>
#define fst first
#define snd second
#define BIT(x,i) ((x>>i)&1)
#define pi acos(-1)
#define to_radian(x) (x*pi/180.0)
#define to_degree(x) (x*180.0/pi)
#define Log(x) (31-__builtin_clz((int)x))
#define LogLL(x) (63-__builtin_clzll((ll)x)
using namespace std;
#include "combo.h"
//#define press(s) IR.cal(s)
struct Interactive
{
int n;
string s;
void Init(int _n)
{
n=_n;
cin>>s;
}
int cal(string a)
{
for(int i=n;i>=1;i--)
if(a.find(s.substr(0,i))!=a.npos)
return i;
return 0;
}
} IR;
string guess_sequense(int _n)
{
int n=_n;
if(n==1)
{
if(press("A")) return "A";
if(press("B")) return "B";
if(press("X")) return "X";
return "Y";
}
string s;
int k=press("BXBY");
if(k==0) s="A";
else if(k==1)
{
k=press("BAX");
if(k==0) s="Y";
else if(k==1) s="X";
else s="B";
}
else s=(press("B") ? "B" : "X");
string t;
if(s=="A") t="BXY";
else if(s=="B") t="XYA";
else if(s=="X") t="YAB";
else t="ABX";
for(int i=2;i<n;i++)
{
string now="";
now+=s; now+=t[0];
now+=s; now+=t[1]; now+=t[0];
now+=s; now+=t[1]; now+=t[1];
now+=s; now+=t[1]; now+=t[2];
k=press(now);
if(k==s.size()) s+=t[2];
else if(k==s.size()+2) s+=t[1];
else s+=t[0];
}
if(press(s+t[0])==n) s+=t[0];
else if(press(s+t[1])==n) s+=t[1];
else s+=t[2];
return s;
}
/*
int main()
{
freopen("combo.inp","r",stdin);
freopen("combo.out","w",stdout);
int n;
cin>>n;
IR.Init(n);
cout<<guess_sequense(n);
}
*/