제출 #413147

#제출 시각아이디문제언어결과실행 시간메모리
413147schse콤보 (IOI18_combo)C++14
100 / 100
55 ms448 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...