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;
const int mxN = 2005;
string guess_sequence(int n) {
string p = "", comb;
if(press("A") == 1)
p = "A", comb = "BXY";
else if(press("B") == 1)
p = "B", comb = "AXY";
else if(press("X") == 1)
p = "X", comb = "ABY";
else
p = "Y", comb = "ABX";
if(n == 1) return p;
for(int i = 2; i < n; i++) {
int match = press(p+comb[0]+p+comb[1]+comb[0]+p+comb[1]+comb[1]+p+comb[1]+comb[2]);
if(match == i-1)
p += comb[2];
else if(match == i)
p += comb[0];
else
p += comb[1];
}
if(press(p+comb[0]) == n)
p += comb[0];
else if(press(p+comb[1]) == n)
p += comb[1];
else
p += comb[2];
return p;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |