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>
using namespace std;
#include "combo.h"
string guess_sequence(int N) {
string ans = "";
vector<char> vect1 = {'A','B','X','Y'};
if(press("AB")>=1){
if(press("A")==1){
//cout << "YES";
ans += 'A';
vect1.erase(find(vect1.begin(),vect1.end(),'A'));
}
else{
ans += 'B';
vect1.erase(find(vect1.begin(),vect1.end(),'B'));
}
}
else{
if(press("X")==1){
ans += 'X';
vect1.erase(find(vect1.begin(),vect1.end(),'X'));
}
else{
ans += 'Y';
vect1.erase(find(vect1.begin(),vect1.end(),'Y'));
}
}
if(N==1){
return ans;
}
for(int i=1;i<N-1;i++){
string temp = "";
temp += ans;
temp += vect1[0];
temp += ans+vect1[1]+vect1[0];
temp += ans+vect1[1]+vect1[1];
temp += ans+vect1[1]+vect1[2];
int k = press(temp);
if(k==i+1){
ans += vect1[0];
}
else if(k==i){
ans += vect1[2];
}
else{
ans += vect1[1];
}
}
if(press(ans+vect1[0])==N){
ans += vect1[0];
}
else if(press(ans+vect1[1])==N){
ans += vect1[1];
}
else{
ans += vect1[2];
}
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |