제출 #536416

#제출 시각아이디문제언어결과실행 시간메모리
536416timreizin콤보 (IOI18_combo)C++17
100 / 100
64 ms548 KiB
#include "combo.h" #include <vector> #include <algorithm> using namespace std; string guess_sequence(int n) { string s = ""; if (press("AB") >= 1) { if (press("A") >= 1) s += 'A'; else s += 'B'; } else { if (press("X") >= 1) s += 'X'; else s += 'Y'; } if (n == 1) return s; vector<char> chars{'A', 'B', 'X', 'Y'}; chars.erase(find(chars.begin(), chars.end(), s.front())); for (int i = 1; i + 1 < n; ++i) { int c = press(s + chars[0] + s + chars[1] + chars[0] + s + chars[1] + chars[1] + s + chars[1] + chars[2]); if (c == i) s += chars[2]; else if (c == i + 1) s += chars[0]; else s += chars[1]; } if (press(s + 'A' + s + 'B') == n) { if (press(s + 'A') == n) s += 'A'; else s += 'B'; } else { if (press(s + 'X') == n) s += 'X'; else s += 'Y'; } return s; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...