K Boxes
There are $N$ thieves numbered $1, 2, \ldots, N$. The thief numbered $i$ has a level of $A_i$ and has $B_i$ gold coins with him. All the levels $A_i$ are distinct integers in the range $1$ to $N$. A thief $i$ can steal from another thief $j$ if and only if his level is greater than the level of the other thief, i.e. $A_i > A_j$. A single thief can only try to steal from at most $K$ other thieves
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