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"
using namespace std;
std::string guess_sequence(int N) {
std::string p = "";
string s;
int t=press("AB");
if(t!=0){
int t2=press("A");
if(t2==1){
s="A";
}
else
s="B";
}
else
{
int t2=press("X");
if(t2==1){
s="X";
}
else
s="Y";
}
// cout<<"first letter is "<<s<<endl;
int cou=1;
string ans;
ans=s;
while(cou!=N){
string f;
f=ans+"A";
if(press(f)==cou+1){
ans=f;
cou++;
continue;
}
f=ans+"B";
if(press(f)==cou+1){
ans=f;
cou++;
continue;
}
f=ans+"X";
if(press(f)==cou+1){
ans=f;
cou++;
continue;
}
f=ans+"Y";
if(press(f)==cou+1){
ans=f;
cou++;
continue;
}
}
// cout<<"answeeer "<<ans<<endl;
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |