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 <iostream>
#include <bitset>
using namespace std;
int n;
char start;
string others;
void get_start() {
if (press("AB")) {
if (press("A")) {
start = 'A';
others = "BXY";
} else {
start = 'B';
others = "AXY";
}
} else {
if (press("X")) {
start = 'X';
others = "ABY";
} else {
start = 'Y';
others = "ABX";
}
}
}
string guess_sequence(int N) {
n = N;
get_start();
string p = (string) "" + start;
for (int i = 1; i < n - 1; i++) {
int got = press(p + others[0] + p + others[1] + others[0] + p + others[1] + others[1] + p + others[1] + others[2]);
switch (got - i) {
case 0:
p += others[2];
break;
case 1:
p += others[0];
break;
case 2:
p += others[1];
break;
}
}
if (press(p + others[0]) == n) return p + others[0];
else if (press(p + others[1]) == n) return p + others[1];
return p + others[2];
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |