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