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 "combo.h"
#include <bits/stdc++.h>
using namespace std;
vector<char> c(4), ch;
string guess_sequence(int N) {
string p;
if (press("AB")) press("A") ? p='A' : p='B';
else if (press("X")) p='X';
else p='Y';
c[0]='A'; c[1]='B'; c[2]='X'; c[3]='Y';
for (auto x:c) if (x!=p[0]) ch.push_back(x);
if (N==1) return p;
for (int i=2; i<N; i++)
{
string tmp=p+ch[1];
for (auto x:ch) tmp+=p+ch[2]+x;
p+=ch[press(tmp)-i+1];
}
if (press(p+'A'+p+'B')==N) press(p+'A')==N ? p+='A' : p+='B';
else if (press(p+'X')==N) p+='X';
else p+="Y";
return p;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |