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>
using namespace std;
#include "combo.h"
string guess_sequence(int n){
string ans;
string guess[5];
if (press("AB")){
if (press("A")){
ans = "A";
guess[0] = "BB";
guess[1] = "BX";
guess[2] = "BY";
guess[3] = "X";
guess[4] = "Y";
} else {
ans = "B";
guess[0] = "AA";
guess[1] = "AX";
guess[2] = "AY";
guess[3] = "X";
guess[4] = "Y";
}
} else {
if (press("X")){
ans = "X";
guess[0] = "AA";
guess[1] = "AB";
guess[2] = "AY";
guess[3] = "B";
guess[4] = "Y";
} else {
ans = "Y";
guess[0] = "AA";
guess[1] = "AB";
guess[2] = "AX";
guess[3] = "B";
guess[4] = "X";
}
}
for (int i = 1; i < n-1; i++){
int res = press(ans+guess[0] + ans+guess[1] + ans+guess[2] + ans+guess[3]);
if (res == i+2){
ans += guess[0][0];
} else if (res == i+1){
ans += guess[3];
} else {
ans += guess[4];
}
}
if (press(ans+guess[3] + ans+guess[4]) == n){
if (press(ans+guess[3]) == n){
return ans+guess[3];
} else {
return ans+guess[4];
}
} else {
return ans+guess[0][0];
}
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |