← All problemsSign in

Speedrun

CodeChefRating 2304Open on judge ↗

Chef is playing a computer game. There are $N$ monsters on the number line. Chef is at position $0$ on the number line. Initially, the $i^{th}$ monster has health equal to $H_i$ and is at the position $A_i$ on the line. It is guaranteed that $A_i \lt A_{i+1}$ for every $1 \leq i \lt N$. Every second, the following happens: - First, Chef can choose a single index $i$ ($1 \leq i \leq N$) such th

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