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 "combo.h"
#include<bits/stdc++.h>
#pragma GCC optimize ("O2")
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<pii, int> piii;
#define debug(x) {cerr<<#x<<"="<<x<<"\n";}
#define debug2(x, y) {cerr<<"{"<<#x<<", "<<#y<<"}={"<<x<<", "<<y<<"}\n";}
#define debugp(p) {cerr<<#p<<"={"<<p.first<<", "<<p.second<<"}\n";}
#define debugv(abcd) {cerr<<#abcd<<": ";for (auto dcba:abcd) cerr<<dcba<<", "; cerr<<"\n";}
#define pb push_back
#define SZ(x) ((int)x.size())
#define all(x) x.begin(), x.end()
const int inf=1000001000; // 1e9
const ll INF=10000000010000000ll; // 1e16
const int mod=1000000007;
const int MAXN=300010;
string S;
string alpha="ABXY";
char get(int x){
for (char ch:alpha) if (ch!=S[0] && !(x--)) return ch;
assert(0);
return 'Z';
}
string guess_sequence(int n){
if (press("AB")){
if (press("A")) S="A";
else S="B";
}
else{
if (press("X")) S="X";
else S="Y";
}
if (n==1) return S;
while (SZ(S)+2<=n){
string SX=S+get(0);
string SYX=S+get(1)+get(0);
string SYY=S+get(1)+get(1);
string SYZ=S+get(1)+get(2);
int res=press(SX+SYX+SYY+SYZ)-SZ(S);
if (res==0) S+=get(2);
if (res==1) S+=get(0);
if (res==2) S+=get(1);
}
if (press(S+get(0))==n) S+=get(0);
else if (press(S+get(1))==n) S+=get(1);
else S+=get(2);
return S;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |