← All problemsSign in

Volcanic Eruption

CodeChefRating 1793Open on judge ↗

There are $N$ positions along a line, each of which contains either a building (with positive height) or a volcano. You are given this information as an array $A$ of length $N$, where $A_i = 0$ represents a volcano at position $i$, and $A_i \gt 0$ represents a building with height $A_i$ at position $i$. Initially, the lava level is $0$. Every second, all the volcanoes erupt simultaneously, incr

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