Mod and Make Y
Given $2$ parameters $X$ and $Y$ and an array $B$ of length $M$, define $f(B, X) = (((X \mod B_1) \mod B_2) \ldots \mod B_M)$. The array $B$ is called *good* if it is possible to rearrange $B$ in some way such that $f(B, X) = Y$. --- You are given an array $A$ of length $N$, and $2$ parameters $X$ and $Y$. Find all $K$ such that the prefix of array $A$ with length $K$ is good, i.e. $[A_1, A_2,
HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17
CodeSearch Tutor
Hints, not spoilers — it won’t hand over the full solution unless you insist.
Sign in to chat with the tutor and save your progress.
Sign in to start