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;
string button[4]={"A","B","X","Y"};
string guess_sequence(int N){
string ans="";
if(press("AB")){
ans=(press("A"))?"A":"B";
}
else{
ans=(press("X"))?"X":"Y";
}
if(N==1)
return ans;
vector<string> rd;
for(int i=0;i<4;i++){
if(button[i]!=ans)
rd.push_back(button[i]);
}
for(int i=1;i<N;i++){
int scr=press(ans+rd[0]+ans+rd[1]+rd[0]+ans+rd[1]+rd[1]+ans+rd[1]+rd[2]);
//AB AXB AXY AXZ
//else AY
int sz=ans.size();
if(scr==sz+1)
ans+=rd[0];
else if(scr==sz+2)
ans+=rd[1];
else
ans+=rd[2];
}
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |