Submission #1217986

#TimeUsernameProblemLanguageResultExecution timeMemory
1217986islam_2010Combo (IOI18_combo)C++20
0 / 100
19 ms408 KiB
#include <bits/stdc++.h> using namespace std; int press(string s); string guess_sequence(int n) { string s; vector<char> candidates = {'A', 'B', 'X', 'Y'}; string first_try = "AB"; if (press(first_try) == 1) { if (press("A") == 1) { s = "A"; candidates = {'B', 'X', 'Y'}; } else { s = "B"; candidates = {'A', 'X', 'Y'}; } } else { if (press("X") == 1) { s = "X"; candidates = {'A', 'B', 'Y'}; } else { s = "Y"; candidates = {'A', 'B', 'X'}; } } while (s.size() < n) { bool found = false; for (char c : candidates) { int res = press(s + c); if (res == s.size() + 1) { s += c; found = true; break; } } if (!found && s.size() == n - 1) { for (char c : candidates) { if (press(s + c) == n) { s += c; break; } } } } return s; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...