이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "combo.h"
#include <bits/stdc++.h>
std::string guess_sequence(int N) {
using namespace std;
auto guess = [&](string p) {
return press(p);
};
vector<string> ch = {"A", "B", "X", "Y"};
string fst = "?";
for (int i = 0; i < 3; i++) {
string p = ch[i];
int coins = press(p);
if (coins == 1) {
fst = ch[i];
break;
}
}
if (fst == "?") {
fst = "Y";
}
vector<string> nch = {};
for (auto x : ch) {
if (x != fst) nch.push_back(x);
}
string ans = fst;
for (int i = 1; i < N; i++) {
bool found = false;
for (int j = 0; j < 2; j++) {
string tmp = ans + nch[j];
int coins = guess(tmp);
if (coins == i + 1) {
found = true;
ans += nch[j];
break;
}
}
if (!found) {
ans += nch[2];
}
}
return ans;
}
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |