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 <iostream>
#include <string>
#include "combo.h"
using namespace std;
string guess_sequence(int n) {
string s;
char c[3]; int k=0;
if(press("A")) s="A";
else if(press("B")) s="B";
else if(press("X")) s="X";
else s="Y";
if(s[0]!='A') c[k++]='A';
if(s[0]!='B') c[k++]='B';
if(s[0]!='X') c[k++]='X';
if(s[0]!='Y') c[k++]='Y';
for(int i=0;i<n-1;i++)
s+=c[0];
int pre=press(s);
for(int i=pre;i<n;i++) {
s[i]=c[1];
int w=press(s);
if(w>pre) {
pre=w;
i=w-1;
} else {
s[i]=c[2];
pre=press(s);
i=pre-1;
}
}
return s;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |