Submission #435490

#TimeUsernameProblemLanguageResultExecution timeMemory
435490rainboyCombo (IOI18_combo)C++11
100 / 100
48 ms508 KiB
#include "combo.h" using namespace std; string guess_sequence(int n) { string ans, b, x, y; int i; if (press("AB") > 0) { if (press("A") > 0) ans = "A", b = "B", x = "X", y = "Y"; else ans = "B", b = "A", x = "X", y = "Y"; } else { if (press("X") > 0) ans = "X", b = "Y", x = "A", y = "B"; else ans = "Y", b = "X", x = "A", y = "B"; } for (i = 1; i + 1 < n; i++) { int p = press(ans + b + b + ans + b + x + ans + x + b) - i; if (p == 0) ans += y; else if (p == 2) { p = press(ans + b + b) - i; if (p == 2) ans += b + b; else if (p == 1) ans += b + x; else ans += x + b; i++; } else { p = press(ans + x + x) - i; if (p == 2) ans += x + x; else if (p == 1) ans += x + y; else ans += b + y; i++; } } if (i < n) { if (press(ans + x) == n) ans += x; else if (press(ans + y) == n) ans += y; else ans += b; } return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...