Submission #281713

#TimeUsernameProblemLanguageResultExecution timeMemory
281713MrDominoCombo (IOI18_combo)C++14
30 / 100
55 ms544 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; } mt19937 rng((long long) (new char)); string guess_sequence(int n) { string sol; string posi = "ABXY"; if (press(sol + posi[0] + posi[1]) > 0) { if (press(sol + posi[0])) { sol += posi[0]; } else { sol += posi[1]; } } else { if (press(sol + posi[2])) { sol += posi[2]; } else { sol += posi[3]; } } posi = del(posi, sol[0]); while ((int) sol.size() < n) { bool found = 0; shuffle(posi.begin(), posi.end(), rng); 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...