이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "combo.h"
#include <bits/stdc++.h>
using namespace std;
string T[4] = {"A", "B", "X", "Y"};
string guess_sequence(int N) {
if (N == 1) {
if (press(T[0])) {
return T[0];
} else if (press(T[1])) {
return T[1];
} else if (press(T[2])) {
return T[2];
} else {
return T[3];
}
}
int p = -1;
if (press(T[0] + T[1])) {
if (press(T[0])) {
p = 0;
} else {
p = 1;
}
} else if (press(T[2])) {
p = 2;
} else {
p = 3;
}
string ans = T[p];
vector<string> S;
for (int i = 0; i < 4; i++) {
if (i != p) {
S.push_back(T[i]);
}
}
for (int i = 2; i < N; i++) {
string s = ans + S[0] + ans + S[1] + S[0] + ans + S[1] + S[1] + ans + S[1] + S[2];
int v = press(s);
if (v == i + 1) {
ans = ans + S[1];
} else if (v == i) {
ans = ans + S[0];
} else {
ans = ans + S[2];
}
}
if (press(ans + S[0]) == N) {
ans = ans + S[0];
} else if (press(ans + S[1]) == N) {
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... |