제출 #276987

#제출 시각아이디문제언어결과실행 시간메모리
276987azret콤보 (IOI18_combo)C++14
97 / 100
42 ms684 KiB
#include <cassert> #include "combo.h" using namespace std; string L = "ABXY"; string guess_sequence(int N) { string ans = ""; for (int i = 0; i < 4; i++) { string t = ""; t += L[i]; if (i == 3 || press(t) == 1) { swap(L[i], L[0]); break; } } ans += L[0]; for (int i = 0; i < N - 2; i++) { int cl = 1 + i; string t = ""; t += ans + L[1] + L[1]; t += ans + L[1] + L[2]; t += ans + L[1] + L[3]; t += ans + L[2]; // assert(((int) t.size()) <= 4 * N); int c = press(t); if (c == cl + 2) { ans += L[1]; } else if (c == cl + 1) { ans += L[2]; } else { ans += L[3]; } } // assert(((int) ans.size()) == N - 1); if (((int) ans.size()) == N - 1) { for (int i = 1; i < 4; i++) { string t = ans; t += L[i]; if (i == 3 || press(t) == N) { ans += L[i]; break; } } } // assert(((int) ans.size()) == N); return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...