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 sz(x) (int)(x).size()
string guess_sequence(int N) {
string p = "";
string S = "";
int a = press("A");
int b = press("B");
int x = press("X");
if(a) S = "A";
if(b) S = "B";
if(x) S = "X";
else S = "Y";
vector<string> choice;
if(a) choice = {"B", "XX", "XB", "XY", "Y"};
if(b) choice = {"A", "XX", "XA", "XY", "Y"};
if(x) choice = {"A", "BB", "BA", "BY", "Y"};
else choice = {"A", "BB", "BA", "BX", "X"};
for(int i = 1; i < N; ++i){
string to_press = "";
for(int j = 0; j < 4; ++j)
to_press += S + choice[j];
int len = press(to_press);
if(len == sz(S))
S = S + choice.back();
else if(len == sz(S) + 1)
S.push_back(choice.front().front());
else
S.push_back(choice[1].front());
}
return S;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |