← All problemsSign in

B - Arithmetic Subarrays

Let's define the array $[B_1, B_2, \ldots, B_M]$ to be *good* if there exists a permutation of $[B_1, B_2, \ldots, B_M]$ that is an arithmetic progression. Formally, the array is *good* if there exist arrays $C$ and $D$ such that all of the following are satisfied: - $|C|=|D|=|B|=M$. - $C$ is a permutation of the integers from $1$ to $M$. That is, each of the numbers from $1$ to $M$ appears exa

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.

voice by Sarvam AI

Sign in to chat with the tutor and save your progress.

Sign in to start