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 a='A', b='B', x='X', y='Y';
string s;
if (press("AB")){
if (press("A"));
else swap(b, a);
}else{
if (press("X")) swap(x, a);
else swap(y, a);
}
s.push_back(a);
if (N==1) return s;
while ((int)s.size()+2<=N){
string ask=s+b+s+x+b+s+x+x+s+x+y;
int tmp=press(ask);
if (tmp==(int)s.size()+1) s.push_back(b);
else if (tmp==(int)s.size()+2) s.push_back(x);
else s.push_back(y);
}
if (press(s+b)==N) s.push_back(b);
else if (press(s+x)==N) s.push_back(x);
else s.push_back(y);
return s;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |