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;
#define len(a) ((int)(a).size())
string guess_sequence(int N) {
string p = "";
int x;
char ch[4] = {'A', 'B', 'X', 'Y'};
x = press("AB");
if(x == 2) p += "AB";
else if(x){
x = press("A");
if(x) p += "A";
else p += "B";
}
else{
x = press("X");
if(x) p += "X";
else p += "Y";
}
if(N == len(p)) return p;
vector<char> v;
for(int i = 0; i < 4; i++){
if(ch[i] == p[0]) continue;
v.push_back(ch[i]);
}
for(int i = len(p) + 1; i < N; i++){
x = press(p + v[0] + p + v[1] + v[0] + p + v[1] + v[1] + p + v[1] + v[2]);
if(x == len(p) + 1) p += v[0];
else if(x == len(p) + 2) p += v[1];
else p += v[2];
}
x = press(p + v[0]);
if(x == N) p += v[0];
else{
x = press(p + v[1]);
if(x == N) p += v[1];
else p += v[2];
}
return p;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |