← All problemsSign in

Bullets and Enemies

CodeChefRating 2752Open on judge ↗

There are $N$ enemies standing from left to right with strengths $S_1, S_2, \ldots, S_N$. $M$ bullets are to be fired from the left side such that only one bullet is fired at a time. The $i^{th}$ bullet $(1 \le i \le M)$ has power $P_i$ and capacity $C_i$. This means that the $i^{th}$ bullet affects the first $C_i$ **alive** enemies from the left side and decreases the strength of each of those

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