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 letters = "ABXY"; string ans; int n; char first; char one; char two; char remain; string t1,t2,t3;
char next() {
int val = press((ans + one) + (ans + t1) + (ans + t2) + (ans + t3));
if(val == (int)ans.size()) {
return remain;
} else if(val == (int)ans.size() + 1) {
return one;
} else {
return two;
}
}
string guess_sequence(int N) {
n = N;
if(press("AB")) {
if(press("A")) {
first = 'A';
one = 'B';
two = 'X';
remain = 'Y';
t1 = "XB";
t2 = "XY";
t3 = "XX";
} else {
first = 'B';
one = 'A';
two = 'X';
remain = 'Y';
t1 = "XA";
t2 = "XY";
t3 = "XX";
}
} else {
if(press("X")) {
first = 'X';
one = 'A';
two = 'B';
remain = 'Y';
t1 = "BA";
t2 = "BY";
t3 = "BB";
} else {
first = 'Y';
one = 'A';
two = 'B';
remain = 'X';
t1 = "BA";
t2 = "BX";
t3 = "BB";
}
}
ans += first;
while((int)ans.size() != N-1) {
ans += next();
}
if(press((ans+one)+(ans+two)) == N) {
if(press(ans+one) == N) {
ans += one;
} else {
ans += two;
}
} else {
ans += remain;
}
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |