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>
#define rep(i,n)for(int i=0;i<(n);i++)
using namespace std;
#include "combo.h"
string s="ABXY";
string guess_sequence(int N) {
char c='?';
rep(i,3){
string ask;ask+=s[i];
int res=press(ask);
if(res){
c=s[i];
break;
}
}
if(c=='?')c=s[3];
string ans;ans+=c;
string t;
rep(i,4){
if(s[i]!=c)t+=s[i];
}
for(int i=1;i<N-1;i++){
string ask=ans+t[0];
rep(j,3)ask+=ans+t[1]+t[j];
int res=press(ask);
if(res==i){
ans+=t[2];
}
else if(res==i+1){
ans+=t[0];
}
else if(res==i+2){
ans+=t[1];
}
else abort();
}
char last='?';
rep(i,2){
int res=press(ans+t[i]);
if(res==N){
last=t[i];
break;
}
}
if(last=='?')last=t[2];
ans+=last;
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |