Submission #1208947

#TimeUsernameProblemLanguageResultExecution timeMemory
1208947thewizardmanCombo (IOI18_combo)C++20
0 / 100
0 ms408 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; string str[3] = {"BB", "XB", "XX"}; string mt[3][3] = { {"Y", "Y", "Y"}, {"XY", "BX", "BY"}, {"BB", "XB", "XX"} }; string guess_sequence(int n) { string s; if (press("AB")) { if (press("A")) s += "A"; else s += "B"; } else { if (press("X")) s += "X"; else s += "Y"; } for (auto& st: str) for (auto& c: st) if (c == s[0]) c = 'A'; for (auto& a: mt) for (auto& st: a) for (auto& c: st) if (c == s[0]) c = 'A'; int c = 0; while (s.length() < n-1) { string p; for (auto st: str) p += s + st; int i = press(p) - s.length(); c++; if (i == 0) { s += mt[0][0]; } else { s += mt[i][press(s + mt[i][2]) - s.length()]; } } if (s.length() == n-1) { if (press(s + "AB") > s.length()) { if (press(s + "A") > s.length()) s += "A"; else s += "B"; } else { if (press(s + "X") > s.length()) s += "X"; else s += "Y"; } } return s; } /* wlog a is first bb xb xx 0 -> yb yx yy 1 -> bx by xy 2 -> bb xb xx */
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...