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;
string guess_sequence(int N) {
if(N==1) {
int k=press("A");
if(k==1) return "A";
k=press("B");
if(k==1) return "B";
k=press("X");
if(k==1) return "X";
return "Y";
}
int k=press("ABA");
char c;
if(k==0) {
if(press("X")) c='X';
else c='Y';
} else {
if(press("A")) c='A';
else c='B';
}
string res="";
res+=c;
char a[3]={'A','B','X'};
if(c=='A')a[0]='Y';
if(c=='B')a[1]='Y';
if(c=='X')a[2]='Y';
for(int i=2;i<N;i++) {
int z=res.size()+1;
string tmp=res+a[0]+a[1]+res+a[0]+a[0]+res+a[0]+a[2]+res+a[1];
int r=press(tmp);
if(r==z)res+=a[1];
else if(r>z)res+=a[0];
else res+=a[2];
}
if(press(res+a[0])==N)res+=a[0];
else if(press(res+a[1])==N)res+=a[1];
else res+=a[2];
return res;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |