제출 #1110889

#제출 시각아이디문제언어결과실행 시간메모리
1110889HasanV11010238콤보 (IOI18_combo)C++17
5 / 100
1 ms384 KiB
#include "combo.h" #include <vector> using namespace std; vector<char> c = {'A', 'B', 'X', 'Y'}; string guess_sequence(int N){ string ans = "", q; int l = 0, r = 3; while (l != r){ int mid = (l + r) / 2; q = ""; for (int i = l; i <= mid; i++){ q += c[i]; } if (press(q) == 0){ l = mid + 1; } else{ r = mid; } } vector<char> al; for (int i = 0; i < 4; i++){ if (l != i){ al.push_back(c[i]); } } ans += c[l]; for (int i = 0; i < N - 2; i++){ q = ans + al[0] + ans + al[1] + al[0] + ans + al[1] + al[1] + ans + al[1] + al[2]; int res = press(q); if (res == i + 1){ ans += al[2]; } else if (res == i + 2){ ans += al[0]; } else{ ans += al[1]; } } if (press(ans + al[0]) == N) return ans + al[0]; if (press(ans + al[1]) == N) return ans + al[1]; return ans + al[2]; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...