# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1134885 | hxano | 콤보 (IOI18_combo) | C++17 | 0 ms | 0 KiB |
#include "combo.h"
#include <bits/stdc++.h>
#define ll long long
#define ii pair<ll,ll>
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define lwb lower_bound
#define upb upper_bound
#define ld long double
#define ins insert
#define del erase
#define ull unsigned long long
using namespace std;
const ll big=3e5+9;
const ll inf=1e16;
const ll mod=1e9+7;
struct tr{ll fi,se,th; tr(ll _fi=0, ll _se=0, ll _th=0){fi=_fi; se=_se; th=_th;}};
ll mxz(ll &t, ll val){if (t<val){t=val; return 1;} return 0;}
ll mnz(ll &t, ll val){if (t>val){t=val; return 1;} return 0;}
ll qpw(ll n, ll k, ll m=mod){ll p=1, t=n%m; while (k){if (k&1) p=p*t%m; t=t*t%m; k>>=1;} return p;}
void add(ll &a, ll b){a+=b; if (a>=mod) a-=mod; return;}
string guess_sequence(ll n){
string s="";
string str="ABXY";
ll type=0;
type+=(!!press("BY"));
type+=2*(!!press("XY"));
s=str[type];
string non="";
for (ll i=0; i<4; ++i) if (str[i]!=s[0]) non+=str[i];
for (ll i=2; i<=n-1; ++i){
string t="";
for (ll i=0; i<3; ++i) t+=s+non[0]+non[i];
t+=s+non[1];
ll z=press(t);
s+=non[i+1-z];
}
if (press(s+non[0])==n) return s+non[0];
if (press(s+non[1])==n) return s+non[1];
return s+non[2];
}