Unreachable
There are $N$ people standing in a line. The $i$-th person from the left has a *strength* of $A_i$. It is guaranteed that $A_i = 1$ or $A_i = 2$ for each person. Suppose person $i$ is holding a ball. They can throw the ball to person $j$ **if and only if** $A_i$ divides $|i - j|$, i.e. if the strength of person $i$ divides the distance between persons $i$ and $j$. Your task is to find whether
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