제출 #916347

#제출 시각아이디문제언어결과실행 시간메모리
916347wii콤보 (IOI18_combo)C++17
100 / 100
11 ms1960 KiB
#include <bits/stdc++.h> #include <combo.h> using namespace std; string guess_sequence(int n) { string ans = ""; int cnt = press("AB"); if (cnt == 2) ans = "A"; else if (cnt == 1) ans = (press("A") == 1 ? "A" : "B"); else if (cnt == 0) ans = (press("X") == 1 ? "X" : "Y"); if (n == 1) return ans; string query = "ABXY"; for (int i = 0; i < 4; ++i) if (query[i] == ans[0]) { query.erase(i, 1); break; } for (int i = 1; i < n - 1; ++i) { int id = press(ans + query[2] + query[0] + ans + query[2] + query[1] + ans + query[2] + query[2] + ans + query[1]); ans += query[id - ans.size()]; } if (press(ans + query[0]) == n) return ans + query[0]; if (press(ans + query[1]) == n) return ans + query[1]; return ans + query[2]; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...