Submission #171702

#TimeUsernameProblemLanguageResultExecution timeMemory
171702triple_faultCombo (IOI18_combo)C++14
100 / 100
52 ms600 KiB
#include "combo.h" #include <vector> std::string guess_sequence(int N) { std::string S = ""; std::string fc = ""; if (press("AB")) { if (press("A")) fc = "A"; else fc = "B"; } else { if (press("X")) fc = "X"; else fc = "Y"; } S = fc; std::vector<std::string> oops = {"A", "B", "X", "Y"}; std::vector<std::string> chars; for (auto &each: oops) if (each != fc) chars.push_back(each); for (int n = 2; n < N; ++n) { std::string p = ""; p += S + chars[0] + S + chars[1] + chars[0] + S + chars[1] + chars[1] + S + chars[1] + chars[2]; int ret = press(p); if (ret == n) S += chars[0]; else if (ret == (n + 1)) S += chars[1]; else S += chars[2]; } std::string p1 = S; std::string p2 = S; if (N > 1) { p1 += chars[0]; p2 += chars[1]; } if (press(p1) == N) return p1; else if (press(p2) == N) return p2; else if (N > 1) return S + chars[2]; else return S; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...