Submission #83802

#TimeUsernameProblemLanguageResultExecution timeMemory
83802AdrienVannsonCombo (IOI18_combo)C++17
0 / 100
31 ms320 KiB
#include <bits/stdc++.h> #include "combo.h" using namespace std; string res = ""; bool estSuivantAB; string guess_sequence (int nbElements) { estSuivantAB = press("AB") > 0; while ((int)res.size() < nbElements) { const char interdit = res.size() ? res[0] : '_'; bool doitRecalculer = res.empty(); char car1, car2; if (estSuivantAB) { car1 = 'A'; car2 = 'B'; } else { car1 = 'X'; car2 = 'Y'; } if (interdit == car1) { res += car2; doitRecalculer = true; } else if (interdit == car2) { res += car1; doitRecalculer = true; } else { string requete; if (interdit != 'A') { requete += res+car1+'A'; } else if (interdit != 'B') { requete += res+car1+'B'; } const int reponse = press(requete); if (reponse > (int)res.size()) { estSuivantAB = reponse == (int)res.size() + 2; res += car1; } else { res += car2; doitRecalculer = true; } } if (doitRecalculer) { if (interdit == 'A' || interdit == 'B') { estSuivantAB = press(res+"X"+res+"Y") <= (int)res.size(); } else { estSuivantAB = press(res+"A"+res+"B") > (int)res.size(); } } } return res; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...