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 "combo.h"
using namespace std;
#define ll long long
const int INF=1e9;
const ll LINF=1e18;
#define fi first
#define se second
#define pii pair<int,int>
#define mid ((l+r)/2)
#define sz(a) (int((a).size()))
#define all(a) a.begin(),a.end()
#define endl "\n"
#define PRINT(x) cerr<<#x<<'='<<x<<endl;
#define pb push_back
#define PRINTvec(niz) { cerr<<#niz<<"="; for(auto _i:niz) cerr<<_i<<" "; cerr<<endl; }
string guess_sequence(int N){
if(N>1){
int p=press("AB");
string S="",T;
if(p==2) S="A";
else if(p==1){
p=press("A");
if(p==1) S="A";
else S="B";
}
else{
p=press("X");
if(p==1) S="X";
else S="Y";
}
T+=S[0];
for(auto c:{'A','B','X','Y'}){
if(c!=S[0]) T+=c;
}
while(sz(S)<N-1){
string ask=S+T[1]+T[1]+S+T[1]+T[2]+S+T[1]+T[3]+S+T[2];
p=press(ask);
if(p==sz(S)+2) S.pb(T[1]);
else if(p==sz(S)+1) S.pb(T[2]);
else S.pb(T[3]);
}
p=press(S+T[1]);
if(p==N) return S+T[1];
p=press(S+T[2]);
if(p==N) return S+T[2];
return S+T[3];
}
else{
int p=press("A");
if(p) return "A";
p=press("B");
if(p) return "B";
p=press("X");
if(p) return "X";
return "Y";
}
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |