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 <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include "combo.h"
using namespace std;
using namespace __gnu_pbds;
#define watch(x) cout<<(#x)<<"="<<(x)<<'\n'
#define mset(d,val) memset(d,val,sizeof(d))
#define setp(x) cout<<fixed<<setprecision(x)
#define forn(i,a,b) for(int i=a;i<b;i++)
#define fore(i,a,b) for(int i=a;i<=b;i++)
#define pb push_back
#define F first
#define S second
#define INF 2e14
#define MOD 998244353
#define pqueue priority_queue
#define fbo find_by_order
#define ook order_of_key
typedef long long ll;
typedef pair<ll,ll> ii;
typedef vector<ll> vi;
typedef vector<ii> vii;
typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> pbds;
#define MAXN 100005
vector<string> c = {"A","B","X","Y"};
string guess_sequence(int n){
string ans="";
forn(i,0,3){
if(press(c[i])){
ans+=c[i];
c.erase(c.begin()+i);
break;
}
}
if(ans==""){
ans+=c[3];
c.erase(c.begin()+3);
}
forn(i,1,n-1){
string p=ans+c[0];
forn(j,0,3){
p+=ans+c[1]+c[j];
}
//cout<<p<<'\n';
int res=press(p);
if(res==i+1) ans+=c[0];
else if(res==i+2) ans+=c[1];
else ans+=c[2];
}
//cout<<ans<<'\n';
int res=press(ans+c[0]);
if(res==n) return ans+c[0];
res=press(ans+c[1]);
if(res==n) return ans+c[1];
return ans+c[2];
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |