Append Average
You are given an array $A$ of length $N$. You must perform the following operation **exactly** $K$ times: - Choose two distinct indices $i$ and $j$ ($1 \le i \lt j \leq N$). - Then, - If $(A_i + A_{j})$ is even, append $\frac{A_i + A_{j}}{2}$ to $A$. - If $(A_i + A_{j})$ is odd, append $\frac{A_i + A_{j} + 1}{2}$ to $A$. - $N$ is increased by $1$ after this. Find the minimum possible su
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