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;
#ifdef LOCAL
#define deb(...) logger(#__VA_ARGS__, __VA_ARGS__)
template<typename ...Args>
void logger(string vars, Args&&... values) {
cerr<<vars<<" = ";
string delim="";
(...,(cerr<<delim<<values,delim=", "));
cerr<<"\n";
}
#else
#define deb(...) logger(#__VA_ARGS__, __VA_ARGS__)
template<typename ...Args>
void logger(string vars, Args&&... values) {}
#endif
#define pb push_back
#define sz(x) (int)(x.size())
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
template<typename T> inline void maxa(T& a,T b){a=max(a,b);}
template<typename T> inline void mina(T& a,T b){a=min(a,b);}
// int press(string p){
// string S="ABXYY";
// deb(p);
// string pref=S;
// while(sz(pref)){
// if(p.find(pref)!=string::npos){
// deb(pref);
// return sz(pref);
// }
// pref.pop_back();
// }
// return 0;
// }
string guess_sequence(int N){
string res="";
if(press("AB"))
res=press("A")?"A":"B";
else
res=press("X")?"X":"Y";
string val="AXBY";
for(int i=0;i<4;i++){
if(val[i]==res[0]){
val.erase(val.begin()+i);
break;
}
}
while(sz(res)<N-1){
int num=press(res+val[0]+val[0]+res+val[1]+res+val[0]+val[1]+res+val[0]+val[2]);
if(num==sz(res)){
res+=val[2];
} else if(num==sz(res)+2){
res+=val[0];
} else{
res+=val[1];
}
}
if(sz(res)<N-1){
if(press(res+val[0]+res+val[1])==N)
res+=press(res+val[0])==N?val[0]:val[1];
else
res+=val[2];
}
return res;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |