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 guess_sequence (int n) {
string s = "AB";
string ans;
if (press (s)) {
if (press ("A"))
ans += 'A';
else
ans += 'B';
}
else {
if (press ("X"))
ans += 'X';
else
ans += 'Y';
}
string c;
if (ans[0] != 'A')
c += 'A';
if (ans[0] != 'B')
c += 'B';
if (ans[0] != 'X')
c += 'X';
if (ans[0] != 'Y')
c += 'Y';
for (int i = 1; i < n - 1; i++) {
string p = ans + c[0] + ans + c[1] + c[0] + ans + c[1] + c[1] + ans + c[1] + c[2];
int w = press (p);
if (w == i + 1)
ans += c[0];
if (w == i + 2)
ans += c[1];
if (w == i)
ans += c[2];
}
if (n > 1) {
if (press (ans + c[0]) == n)
ans += c[0];
else if (press (ans + c[1]) == n)
ans += c[1];
else
ans += c[2];
}
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |