Submission #83867

#TimeUsernameProblemLanguageResultExecution timeMemory
83867AdrienVannsonCombo (IOI18_combo)C++17
100 / 100
57 ms676 KiB
#include <bits/stdc++.h> #include "combo.h" using namespace std; string res = ""; string guess_sequence (int nbCaracteres) { if (press("AB") > 0) { res += press("A") ? 'A' : 'B'; } else { res += press("X") ? 'X' : 'Y'; } if (nbCaracteres == 1) { return res; } string caracteres; for (char c : "ABXY") { if (c != res[0] && c != 0) { caracteres.push_back(c); } } while ((int)res.size() < nbCaracteres-1) { const int reponse = press(res+caracteres[0] + res+caracteres[1]+caracteres[0] + res+caracteres[1]+caracteres[1] + res+caracteres[1]+caracteres[2]); if (reponse == (int)res.size()+2) { res += caracteres[1]; } else if (reponse == (int)res.size()+1) { res += caracteres[0]; } else { res += caracteres[2]; } } if (press(res+caracteres[0]) == nbCaracteres) { return res + caracteres[0]; } if (press(res+caracteres[1]) == nbCaracteres) { return res + caracteres[1]; } return res + caracteres[2]; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...