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 isz(a) ((signed)a.size())
string alphabet = "ABXY";
string guess_sequence(int n){
string s = "";
// first character
if (press("AB") == 0){
if (press("X") == 0){
s += "Y";
}
else{
s += "X";
}
}
else{
if (press("A") == 0){
s += "B";
}
else{
s += "A";
}
}
alphabet.erase(alphabet.find(s), 1);
for (int i = 1; i < n - 1; i++){
string query = "";
query += s + alphabet[0] + alphabet[0];
query += s + alphabet[0] + alphabet[1];
query += s + alphabet[0] + alphabet[2];
query += s + alphabet[1];
int val = press(query);
if (val == isz(s) + 2){
s += alphabet[0];
}
else if (val == isz(s) + 1){
s += alphabet[1];
}
else{
s += alphabet[2];
}
}
string query = s + alphabet[0];
int val1 = press(query);
query = s + alphabet[1];
int val2 = press(query);
if (val1 == isz(s) + 1){
s += alphabet[0];
}
else if (val2 == isz(s) + 1){
s += alphabet[1];
}
else{
s += alphabet[2];
}
return s;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |