# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
919582 | Khanhcsp2 | 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 "combo.h"
#include <bits/stdc++.h>
#define el '\n'
#define fi first
#define sc second
#define int long long
using namespace std;
using ll=long long;
using ull=unsigned long long;
using ld=long double;
const int mod=1e9+7;
const int N=1e5+11;
string guess_sequence(int n)
{
string s="ABXY", ans="";
int ch, pos;
ch=press("AB");
if(ch)
{
int v=press("A");
if(v) pos=0;
else pos=1;
}
else
{
int v=press("X");
if(v) pos=2;
else pos=3;
}
ans+=s[pos];
swap(s[pos], s[3]);
for(int i=1;i<n;i++)
{
string tmp=ans+s[0]+s[0]+ans+s[0]+s[1]+ans+s[0]+s[2]+ans+s[1];
int l=press(tmp);
if(l==i+2) ans+=s[0];
else if(l==i+1) ans+=s[1];
else ans+=s[2];
}
if(press(ans+s[0])==n) return ans+s[0];
else if(press(ans+s[1])==n) return ans+s[1];
else return ans+s[2];
}
//void sol()
//{
//
//}
//signed main()
//{
//// freopen("task.INP", "r", stdin);
//// freopen("task.OUT", "w", stdout);
// ios_base::sync_with_stdio(0);
// cin.tie(0);
// int t=1;
// //cin >> t;
// while(t--)
// {
// sol();
// }
//}