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) {
char f;
if (press("AB")) {
if (press("A")) f='A';
else f='B';
} else {
if (press("X")) f='X';
else f='Y';
}
int len=1;
if (len==n) {string s; s+=f; return s;}
string ans; ans+=f;
char a='0',b='0',c='0';
for (char i='A'; i<='Y'; ++i) {
if (i>'B' && i<'X') continue;
if (i==f) continue;
if (a=='0') a=i;
else if (b=='0') b=i;
else c=i;
}
while (len<n-1) {
string s;
s+=ans; s+=a; s+=a;
s+=ans; s+=a; s+=b;
s+=ans; s+=a; s+=c;
s+=ans; s+=b;
int x=press(s);
if (x==len+2) ans+=a;
else if (x==len+1) ans+=b;
else ans+=c;
++len;
}
string s;
s+=ans; s+=a; s+=ans; s+=b;
if (press(s)==n) {
if (press(ans+a)==n) return ans+a;
else return ans+b;
} else return ans+c;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |