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 <bits/stdc++.h>
#include "combo.h"
using namespace std;
string moves = "ABXY";
string s;
void get_first() {
if (press("AB") > 0) {
if (press("A") > 0) {
s = "A";
} else {
s = "B";
}
} else {
if (press("X") > 0) {
s = "X";
} else {
s = "Y";
}
}
moves.erase(moves.find(s[0]), 1);
}
void get_next() {
string p = s + moves[0];
for (char c : moves) {
p += s;
p.push_back(moves[1]);
p.push_back(c);
}
switch (press(p) - s.size()) {
case 0:
s.push_back(moves[2]);
break;
case 1:
s.push_back(moves[0]);
break;
case 2:
s.push_back(moves[1]);
break;
}
}
void get_last() {
if (press(s + moves[0] + s + moves[1]) - s.size() == 1) {
if (press(s + moves[0]) - s.size() == 1) {
s += moves[0];
} else {
s += moves[1];
}
} else {
s += moves[2];
}
}
string guess_sequence(int N) {
get_first();
for (int i = 1; i < N - 1; ++i)
get_next();
if (N > 1) get_last();
return s;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |