← All problemsSign in

Burglar Movements

CodeChefRating 2470Open on judge ↗

There is a row of $N$ houses, numbered $1$ to $N$. The $i$-th house has $A_i$ coins in it. There is a burglar initially at house $S$. Each day, the burglar can do **exactly** one of the following actions (assuming he is at house $X$): - Do nothing. - If $X > 1$, move to house $X - 1$. - If $X < N$, move to house $X + 1$. - If house $X$ has not already been robbed, then choose to rob the house. H

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