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;
#define pb push_back
std::string guess_sequence(int n) {
char ilk;
vector<char> v;
string s;
s+='A';
s+='B';
int para = press(s);
if(para==1 || para==2){
s.clear();
s+='A';
para=press(s);
if(para==1)ilk='A';
else ilk='B';
}
else{
s.clear();
s+='X';
para=press(s);
if(para==1)ilk='X';
else ilk='Y';
}
if(ilk!='X')v.pb('X');
if(ilk!='Y')v.pb('Y');
if(ilk!='A')v.pb('A');
if(ilk!='B')v.pb('B');
string S;
S=ilk;
for(int i=2;i<n;i++){
s.clear();
s=S;
s+=v[0];
s+=S;
s+=v[1];
s+=v[0];
s+=S;
s+=v[1];
s+=v[1];
s+=S;
s+=v[1];
s+=v[2];
para=press(s);
if(para==i-1)S+=v[2];
else if(para==i)S+=v[0];
else{
S+=v[1];
}
}
if(n>1){
s.clear();
s=S;
s+=v[0];
s+=S;
s+=v[1];
para=press(s);
if(para==n){
s.clear();
s=S;
s+=v[0];
para=press(s);
if(para==n){S+=v[0];}
else S+=v[1];
}
else S+=v[2];
}
return S;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |