← All problemsSign in

Consecutive Deletions

CodeChefRating 2008Open on judge ↗

You are given a positive integer $K$ and a sequence $A_1, A_2, \ldots, A_N$. Initially, each element of this sequence is $0$ or $1$; your goal is to make all elements equal to $0$. In order to do that, you may perform the following operation any number of times: - Choose a subarray (a contiguous subsequence) with length $K$, i.e. choose two indices $L$ and $R$ such that $1 \le L \le R \le N$ a

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