Submission #916344

#TimeUsernameProblemLanguageResultExecution timeMemory
916344wiiCombo (IOI18_combo)C++17
5 / 100
1 ms540 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"); 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...