Submission #331615

#TimeUsernameProblemLanguageResultExecution timeMemory
331615FalconCombo (IOI18_combo)C++17
5 / 100
1 ms248 KiB
#include "combo.h" #include <iostream> #include <cassert> std::string guess_sequence(int N) { std::string p = ""; for(const char c : std::string("ABX")) { p += c; if(press(p)) break; else p = ""; } if(p.empty()) p = "Y"; std::string chars = ""; for(const char c : std::string("ABXY")) if(c && c != p[0]) chars += c; for(int i = 1; i < N - 1; ++i) { std::string a, b, c, d; a = p + chars[0]; b = p + chars[1] + chars[0]; c = p + chars[1] + chars[1]; d = p + chars[1] + chars[2]; switch(press(a + b + c + d) - i) { case 0: p += chars[2]; break; case 1: p += chars[0]; break; case 2: p += chars[1]; break; default: assert(0); } } for(const char c : chars) if(c != chars[0] && press(p + c) == N) { p += c; break; } if(int(p.size()) == N - 1) p += chars[0]; return p; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...