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