← All problemsSign in

Carrot Collection

CodeChefRating 914Open on judge ↗

Deep in a forest live a bear and a rabbit. The forest has $N$ clearings, numbered from $1$ to $N$. Clearing $i$ has $A_i$ carrots growing in it. The bear patrols several zones of the forest - specifically, you are given integers $L$ and $R$, such that the bear patrols clearings $L, L+1, L+2, \ldots, R$. It is guaranteed that either $L \gt 1$ or $R \lt N$, i.e. there exists at least one clear

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