Submission #271811

#TimeUsernameProblemLanguageResultExecution timeMemory
271811SeDunionCombo (IOI18_combo)C++14
100 / 100
41 ms564 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; string guess_sequence (int N) { string X = "X"; string Y = "Y"; string A = "A"; string B = "B"; string s, r(3, '-'); if (press (X + Y)) { if (press(X)) s += X, r = A + B + Y; else s += Y, r = A + B + X; } else { if (press(A)) s += A, r = B + X + Y; else s += B, r = A + X + Y; } if (N == 1) return s; for (int i = 1 ; i < N - 1 ; ++ i) { string cur = s + r[0] + s + r[1] + r[0] + s + r[1] + r[1] + s + r[1] + r[2]; int p = press (cur); if (p == i) { s += r[2]; } else if (p == i + 1) { s += r[0]; } else if (p == i + 2) { s += r[1]; } else { assert (0); } } if (press (s + X + s + Y) == N) { if (press(s + X) == N) s += X; else s += Y; } else { if (press(s + A) == N) s += A; else s += B; } return s; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...