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>
using namespace std;
#include<combo.h>
#define in ({int x=0;int c=getchar(),n=0;for(;!isdigit(c);c=getchar()) n=(c=='-');for(;isdigit(c);c=getchar()) x=x*10+c-'0';n?-x:x;})
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int rnd(int l,int r) {return l+rng()%(r-l+1);}
#define fasty ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define fori(x,a,b) for(int x=a;x<=b;x++)
#define ford(x,a,b) for(int x=a;x>=b;x--)
#define fi first
#define se second
#define forv(a,b) for(auto&a:b)
#define pb push_back
#define all(a) a.begin(),a.end()
#define ii pair<int,int>
#define reset(f,x) memset(f,x,sizeof(f))
#define getbit(x,i) ((x>>i)&1)
#define batbit(x,i) (x|(1ll<<i))
#define tatbit(x,i) (x&~(1<<i))
#define gg exit(0);
string guess_sequence(int n)
{
vector<char> re;
string s = "";
if(press("AB"))
{
if(press("A")) s+='A';
else s+='B';
}
else
{
if(press("X")) s+='X';
else s+='Y';
}
for(char c : {'A','B','X','Y'}) if(s[0]!=c) re.pb(c);
fori(i,2,n-1)
{
string t = s+re[0]+s+re[1]+re[0]+s+re[1]+re[2]+s+re[0]+re[2];
int val = press(t);
if(val==i) s+=re[0];
if(val==i+1) s+=re[1];
if(val==i-1) s+=re[2];
}
string t = s+re[0]+s+re[1];
int val = press(t);
if(val==n)
{
t = s+re[0];
if(press(t)==n) s+=re[0];
else s+=re[1];
}
else s+=re[2];
return s;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |