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>
using namespace std;
std::string guess_sequence(int N) {
string ans="";
if(press("AB")){
if(press("A"))ans+='A';
else ans+='B';
}else{
if(press("X"))ans+='X';
else ans+='Y';
}
string x="";
for(char c:{'A','B','X','Y'}){
if(c!=ans[0])x+=c;
}
if(N==1)return ans;
for(int i=0;i<N-2;i++){
string s=ans+x[0]+ans+x[1]+x[0]+ans+x[1]+x[1]+ans+x[1]+x[2];
int co=press(s)-ans.length();
if(!co)ans+=x[2];
else if(co==1)ans+=x[0];
else ans+=x[1];
}
if(press(ans+x[0])-ans.length())ans+=x[0];
else if(press(ans+x[1])-ans.length())ans+=x[1];
else ans+=x[2];
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |