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 guess_sequence(int n){
int q=press("AB"),w=press("AX");
char s[4]={'A','B','X','Y'};
if (q && w){
swap(s[0],s[3]);
}
if (q && !w){
swap(s[1],s[3]);
}
if (!q && w){
swap(s[2],s[3]);
}
string res,u;
res.push_back(s[3]);
for (int i=1;i<n-1;++i){
u.clear();
for (int j=0;j<i;++j){
u.push_back(res[j]);
}
u.push_back(s[1]);
for (int j=0;j<i;++j){
u.push_back(res[j]);
}
u.push_back(s[0]);
u.push_back(s[0]);
for (int j=0;j<i;++j){
u.push_back(res[j]);
}
u.push_back(s[0]);
u.push_back(s[2]);
for (int j=0;j<i;++j){
u.push_back(res[j]);
}
u.push_back(s[0]);
u.push_back(s[1]);
q=press(u);
if (q==i){
res.push_back(s[2]);
}
if (q==i+1){
res.push_back(s[1]);
}
if (q==i+2){
res.push_back(s[0]);
}
}
u.clear();
for (int i=0;i<n-1;++i){
u.push_back(res[i]);
}
u.push_back(s[0]);
q=press(u);
u.clear();
for (int i=0;i<n-1;++i){
u.push_back(res[i]);
}
u.push_back(s[1]);
w=press(u);
if (q==n){
res.push_back(s[0]);
}
else if (w==n){
res.push_back(s[1]);
}
else {
res.push_back(s[2]);
}
return res;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |