Submission #281616

#TimeUsernameProblemLanguageResultExecution timeMemory
281616MrDominoCombo (IOI18_combo)C++14
10 / 100
105 ms564 KiB
#include <bits/stdc++.h> #include "combo.h" using namespace std; string del(string s, char ch) { string t; for (auto &x : s) { if (x != ch) { t += x; } } return t; } string guess_sequence(int n) { string sol; string posi = "ABXY"; bool found = 0; for (int j = 0; j < 3; j++) { if (press(sol + posi[j]) == 1) { found = 1; sol += posi[j]; break; } } if (found == 0) { sol += posi[3]; } posi = del(posi, sol[0]); while ((int) sol.size() + 2 <= n) { char a = posi[0]; char b = posi[1]; char c = posi[2]; int ret = press(sol + a + b + sol[0] + sol + b + a); if (ret == (int) sol.size()) { sol += c; continue; } if (ret == (int) sol.size() + 1) { int ret = press(sol + a); if (ret == (int) sol.size() + 1) { sol += a; continue; } } bool found = 0; for (int j = 0; j < 2; j++) { if (press(sol + posi[j]) == (int) sol.size() + 1) { found = 1; sol += posi[j]; break; } } if (found == 0) { sol += posi[2]; } } if ((int) sol.size() == n - 1) { bool found = 0; for (int j = 0; j < 2; j++) { if (press(sol + posi[j]) == (int) sol.size() + 1) { found = 1; sol += posi[j]; break; } } if (found == 0) { sol += posi[2]; } } return sol; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...