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 p=' ';
string c="";
vector<char> v(0),b={'A','B','X','Y'};
int ab=press("AB"),ax=press("AX");
if (ab&&ax) p='A';
else if (ab) p='B';
else if (ax) p='X';
else p='Y';
for (char ch:b){
if (p!=ch) v.push_back(ch);
}
c+=p;
if (n==1) return c;
for (int i=1;i<n-1;i++){
string s1=c+v[0],s2=c+v[1];
string s2a=s2+v[0],s2b=s2+v[1],s2c=s2+v[2];
int res=press(s1+s2a+s2b+s2c);
if (res==i+2) c+=v[1];
else if (res==i+1) c+=v[0];
else c+=v[2];
}
int toto1=press(c+v[0]),toto2=press(c+v[1]);
if (toto1==n) return c+v[0];
else if (toto2==n) return c+v[1];
else return c+v[2];
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |