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;
string ch = "ABXY";
string guess_sequence(int n) {
string s = "";
string a = "";
int block = -1;
if (press("AB") >= 1) {
if (press("A") == 1) block = 0;
else block = 1;
} else {
if (press("X") == 1) block = 2;
else block = 3;
}
s += ch[block];
for (int i=0; i<4; i++) {
if (block == i) continue;
a += ch[i];
}
if (n == 1) return s;
for (int i=1; i<n-1; i++) {
int len = press(s+a[0]+s+a[1]+a[1]+s+a[1]+a[0]+s+a[1]+a[2]);
if (len == i + 1) s += a[0];
else if (len == i + 2) s += a[1];
else s += a[2];
}
if (press(s+a[0]) == n) return s+a[0];
else if (press(s+a[1]) == n) return s+a[1];
else return s+a[2];
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |