← All problemsSign in

Chef and Dragon Dens

CodeChefRating 2355Open on judge ↗

Chef is on an adventure to find the tastiest exotic spices. Everyone knows that the best spices are guarded by several ancient dragons that dwell within mountains. The mountain range can be modeled by a polyline in the 2D $xz$ plane that passes through $N$ points $p_1 = (1,h_1), p_2 = (2, h_2), \ldots, p_N = (N, h_N)$, in this order, where $h_i$ is a positive integer for each valid $i$. This po

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