← All problemsSign in

Weeding

CodeChefRating 1119Open on judge ↗

Chef purchased a new herbicide, and now wants to test its effectiveness. Initially, there are no weeds in Chef's garden. For each $i = 1, 2, 3, \ldots, N$, **exactly one** new weed will pop up in the garden at the start of day $A_i$. It is known that $A_1 \lt A_2 \lt \ldots \lt A_N$. Chef can spray the herbicide at most once per day. Any weed that receives the spray $K$ or more times in to

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