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;
char zn[4]={'A','B','X','Y'};
string guess_sequence(int n){
string s="";
s+=zn[0];
s+=zn[1];
if (press(s)>=1){
s="";
s+=zn[0];
if (press(s)==0)swap(zn[0],zn[1]);
}
else{
s="";
s+=zn[2];
if (press(s)==0)swap(zn[0],zn[3]);
else swap(zn[0],zn[2]);
}
s="";
s+=zn[0];
if (n==1)return s;
int wyn;
string cur;
for (int i = 1; i<n-1; i++){
cur="";
cur+=s;cur+=zn[1];cur+=zn[1];
cur+=s;cur+=zn[1];cur+=zn[2];
cur+=s;cur+=zn[1];cur+=zn[3];
cur+=s;cur+=zn[2];
wyn=press(cur);
if (wyn==i)s+=zn[3];
else if (wyn==i+1)s+=zn[2];
else s+=zn[1];
}
cur=s;
cur+=zn[1];
cur+=s;
cur+=zn[2];
wyn=press(cur);
if (wyn==n-1){
s+=zn[3];
}
else{
cur=s;
cur+=zn[1];
wyn=press(cur);
if (wyn==n)s+=zn[1];
else s+=zn[2];
}
return s;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |