이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "combo.h"
#ifndef EVAL
#include "grader.cpp"
#endif
#include <string>
#include <vector>
using namespace std;
std::string guess_sequence(int N)
{
string known = "";
if (press("AB"))
known = (press("A") ? "A" : "B");
else
known = (press("X") ? "X" : "Y");
vector<char> letters;
if (known != "A")
letters.push_back('A');
if (known != "B")
letters.push_back('B');
if (known != "X")
letters.push_back('X');
if (known != "Y")
letters.push_back('Y');
if (N == 1)
return known;
for (int i = 1; i < N - 1; i++)
{
string str;
str = known;
str.push_back(letters[1]);
str.append(known);
str.push_back(letters[2]);
str.push_back(letters[0]);
str.append(known);
str.push_back(letters[2]);
str.push_back(letters[1]);
str.append(known);
str.push_back(letters[2]);
str.push_back(letters[2]);
known.push_back(letters[press(str) - known.size()]);
}
string str1, str2, str3;
str1.push_back(letters[0]);
str2.push_back(letters[1]);
str3.push_back(letters[2]);
if (press(known + str1) == N)
return known + str1;
if (press(known + str2) == N)
return known + str2;
return known + str3;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |