← All problemsSign in

Careless Chef

CodeChefRating 1345Open on judge ↗

Chef has a sequence of integers $A$ of length $N$. He creates another sequence $B$ of length $2 \cdot N$ using sequence $A$. Initially, $B$ is empty. Chef performs the following process. For each element $A_i$ $(1 \le i \le N)$ of $A$: - Choose any arbitrary integer $k$ (Note that the value of $k$ can be different for different elements). - Add $A_i-k$ and $A_i+k$ to $B$. Chef then shuffles the

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