제출 #583664

#제출 시각아이디문제언어결과실행 시간메모리
583664Mystic03콤보 (IOI18_combo)C++17
5 / 100
1 ms208 KiB
#include "combo.h" #include <vector> #include <algorithm> #include <string> using namespace std; std::string guess_sequence(int N) { string s = ""; vector<char> rem{ 'A', 'B', 'X', 'Y' }; if (press("AB")) { if (press("A")) { s.push_back('A'); } else s.push_back('B'); } else { if (press("X")) { s.push_back('X'); } else s.push_back('Y'); } rem.erase(find(rem.begin(), rem.end(), s[0])); for (int i = 1; i < N - 1; i++) { int len = s.size(); string check = s; check.push_back(rem[0]); check.push_back(rem[0]); check += s; check.push_back(rem[0]); check.push_back(rem[1]); check += s; check.push_back(rem[0]); check.push_back(rem[2]); check += s; check.push_back(rem[2]); int newLen = press(check); if (newLen == len + 2) s.push_back(rem[0]); else if (newLen == len + 1) s.push_back(rem[2]); else s.push_back(rem[1]); } string finalAns = s; finalAns.push_back(rem[0]); if (press(finalAns) > (int)s.length()) { return finalAns; } finalAns.pop_back(); finalAns.push_back(rem[1]); if (press(finalAns) > (int)s.length()) { return finalAns; } finalAns.pop_back(); finalAns.push_back(rem[2]); return finalAns; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...