← All problemsSign in

Powers of 2

CodeChefRating 3156Open on judge ↗

You have an array $P$ of length $N$. Also in front of you, there are $N$ bags of gems lined up in a row where the $i$-th bag from the left has $2^{P_i}$ gems in it. You can take any bags of gems from them following the given rules: - You are **not** allowed to take two adjacent bags. - You are allowed to take at most $k$ bags. For each value of $k$ from $1$ to $\lceil \frac{N}{2} \rceil$, find

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