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 S,s;
char c[3];
int k,i;
std::string guess_sequence(int N) {
c[0]='A';
c[1]='B';
c[2]='X';
k=press("AB");
if (k==0)
{
if (press("X")==1) {S="X"; c[2]='Y';}
else {S="Y";}
}
else
{
if (k==2) {S="AB"; c[0]='Y';}
else
{
if (press("A")==1) {S="A"; c[0]='Y';}
else {S="B"; c[1]='Y';}
}
}
i=S.length();
while (i<N-1)
{
k=press(S+c[0]+c[0]+S+c[0]+c[1]+S+c[0]+c[2]+S+c[1]);
if (k==i+2) {S+=c[0];}
else {if (k==i+1) {S+=c[1];} else {S+=c[2];}}
++i;
}
if (i<N)
{
k=press(S+c[0]);
if (k==i+1) {S+=c[0];}
else {if (press(S+c[1])==i+1) {S+=c[1];} else {S+=c[2];}}
}
return S;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |