# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
236900 | michao | 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>
#include "combo.h"
#define ll long long int
#define mp make_pair
#define pb push_back
#define ld long double
#define pii pair<int,int>
#define sz(x) (int)x.size()
#define piii pair<pii,pii>
#define precise cout<<fixed<<setprecision(10)
#define st first
#define nd second
#define ins insert
#define vi vector<int>
#define BOOST ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
using namespace std;
const char lit[4]={'X','Y','A','B'};
string guess_sequence(int n)
{
string ans="";
char first;
int ile1=press("XY");
if (ile1)
{
if (press("X"))first='X';
else first='Y';
}
else
{
if (press("A"))first='A';
else first='B';
}
ans+=first;
vector<char>unused;
unused.clear();
for (int i=0;i<4;i++)if (lit[i]!=first)unuvsed.pb(lit[i]);
for (int i=1;i<=n-2;i++)
{
int news=press(ans+unused[0]+ans+unused[1]+unused[0]+ans+unused[1]+unused[1]+ans
+unused[1]+unused[2]);
if (news==sz(ans)+1)ans+=unused[0];
else if (news==sz(ans)+2)ans+=unused[1];
else ans+=unused[2];
}
if (press(ans+unused[0]+ans+unused[1])==n)
{
if (press(ans+unused[0])==n)ans+=unused[0];
else ans+=unused[1];
}
else ans+=unused[2];
return ans;
}
/*
int32_t main()
{
BOOST;
return 0;
}
*/