#include "combo.h"
#include <bits/stdc++.h>
#define l long long
using namespace std;
string guess_sequence(int N){
l fs = 4; // A B X Y
map<l , string>m;
m[1] = "A";
m[2] = "B";
m[3] = "X";
m[4] = "Y";
string s1 , s2 , s3;
if(press("A") == 1){
fs = 1;
s1 = "B";
s2 = "X";
s3 = "Y";
}
else if(press("B") == 1){
fs = 2;
s1 = "A";
s2 = "X";
s3 = "Y";
}
else if(press("X") == 1){
fs = 3;
s1 = "A";
s2 = "B";
s3 = "Y";
}
else{
s1 = "A";
s2 = "B";
s3 = "X";
}
string pre = m[fs];
if(N==1){
return pre;
}
//ABXYY => n1 = 3
// AB AXB AXX AXY
for(int i = 1; i < N - 1 ; i++){
string test = pre + s1 + pre + s2 + s1 + pre + s2 + s2 + pre + s2 + s3;
l ans = press(test);
cout<<ans<<endl;
if(ans == i + 1){
pre = pre + s1;
}
else if(ans == i + 2){
pre = pre + s2;
}
else{
pre = pre + s3;
}
}
if(press(pre + s1) == N){
pre = pre + s1;
}
else if(press(pre + s2) == N){
pre = pre + s2;
}
else{
pre = pre + s3;
}
return pre;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |