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"
std::string guess_sequence(int N) {
string S,a,b,c;
int tmp=3;
if (press("AB")>=1){
if(press("A")==1)tmp=0,S="A",a="B",b="X",c="Y";
else tmp=1,S="B",a="A",b="X",c="Y";
}else{
if(press("X")==1)tmp=2,S="X",a="A",b="B",c="Y";
else tmp=3,S="Y",a="A",b="B",c="X";
}
for (int i=2;i<N;i++){
string p=S+a+S+b+a+S+b+b+S+b+c;
int X=press(p);
if (X==i-1)S+=c;
else if(X==i)S+=a;
else S+=b;
}
if (press(S+a+S+b)==N){
if (press(S+a)==N)S+=a;else S+=b;
}else S+=c;
return S;
}
Compilation message (stderr)
combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:6:6: warning: variable 'tmp' set but not used [-Wunused-but-set-variable]
6 | int tmp=3;
| ^~~
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |