#include "combo.h"
#include <bits/stdc++.h>
#define ll int
#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];
if (n==1) return s;
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];
}
Compilation message (stderr)
combo.cpp:17:14: warning: overflow in conversion from 'double' to 'int' changes value from '1.0e+16' to '2147483647' [-Woverflow]
17 | const ll inf=1e16;
| ^~~~
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |