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;
std::string guess_sequence(int N) {
string s = "";
string t = "ABXY";
if(press("AB")) {
if(press("A")) {
t.erase(t.begin());
s += "A";
} else {
t.erase(t.begin()+1);
s += "B";
}
} else {
if(press("X")) {
t.erase(t.begin()+2);
s += "X";
} else {
t.erase(t.begin()+3);
s += "Y";
}
}
if(N == 1) return s;
for(int i = 1; i + 1 < N; i++) {
int res = press(s + t[0] + t[0] + s + t[0] + t[1] + s + t[0] + t[2] + s + t[1]);
if(res == i + 2) s += t[0];
else if(res == i + 1) s += t[1];
else s += t[2];
}
if(press(s + t[0] + s + t[1]) == N) {
if(press(s + t[0]) == N) return s + t[0];
return s + t[1];
}
return s + t[2];
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |