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>
using namespace std;
string guess_sequence(int N) {
string ans, p;
if (press("AB")) {
if (press("A")) ans = "A", p = "BXY";
else ans = "B", p = "AXY";
}
else {
if (press("X")) ans = "X", p = "ABY";
else ans = "Y", p = "ABX";
}
if (N == 1) {
return ans;
}
while ((int)ans.size() < N - 1) {
int t = press(ans + p[0] + ans + p[1] + p[0] + ans + p[1] + p[1] + ans + p[1] + p[2]);
if ((int)ans.size() == t - 1) ans += p[0];
else if ((int)ans.size() == t - 2) ans += p[1];
else ans += p[2];
}
if ((int)ans.size() != press(ans + p[0])) ans += p[0];
else if ((int)ans.size() != press(ans + p[1])) ans += p[1];
else ans += p[2];
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |