이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "combo.h"
std::string guess_sequence(int N) {
std::string S;
std::string pos;
// find first letter (3 presses)
if (press("A")) pos = "BXY", S = "A";
else if (press("B")) pos = "AXY", S = "B";
else if (press("X")) pos = "ABY", S = "X";
else pos = "ABX", S = "Y";
// find next N-1 letters (N-1 presses)
for (int i = 0; i < N - 1; i++)
{
// the length of this string will always be < 4N.
int coins = press(S + pos[0] + pos[0] + S + pos[0] + pos[1] + S + pos[0] + pos[2] + S + pos[1]);
if (coins == i + 3)
S += pos[0];
else if (coins == i + 2)
S += pos[1];
else
S += pos[2];
}
return S;
}
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |