이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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 (n == 1) {
return ans;
}
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... |