# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1251541 | nguyenletrung | Combo (IOI18_combo) | C++17 | 0 ms | 0 KiB |
#include<bits/stdc++.h>
#define ll long long
#define fi first
#define se second
#define pb push_back
using namespace std;
//int press(string x)
//{
// return 1;
//}
string guess_sequence(int N)
{
string ans="";
if(press("AB")>0)
{
if(press("A")>0) ans="A";
else ans="B";
}
else
{
if(press("X")>0) ans="X";
else ans="Y";
}
vector<string> vv;
vv.clear();
if(ans=="A")
{
vv.pb("B");
vv.pb("X");
vv.pb("Y");
}
else
if(ans=="B")
{
vv.pb("A");
vv.pb("X");
vv.pb("Y");
}
else
if(ans=="X")
{
vv.pb("A");
vv.pb("B");
vv.pb("Y");
}
else
if(ans=="Y")
{
vv.pb("A");
vv.pb("B");
vv.pb("X");
}
for(int i=1;i<=N-2;i++)
{
string x="";
x=x+ans+vv[0]+vv[0];
x=x+ans+vv[0]+vv[1];
x=x+ans+vv[0]+vv[2];
x=x+ans+vv[1];
int val=press(x);
if(val==i) ans=ans+vv[2];
else
if(val==i+1) ans=ans+vv[1];
else ans=ans+vv[0];
}
press(ans);
string x="";
x=ans+vv[0]+ans+vv[1]+ans+vv[2];
press(x);
}
int main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);cout.tie(0);
// freopen(".inp","r",stdin);
// freopen(".out","w",stdout);
}