Acc to editorial, this is what I understood.

dp(i, j) = {min(k, 2^i) scores from x1,x2,x3—xi}, where j is number of continuous ones behind. So at every new xi, we can either add 0, or 1. If we add 0, then dp(i, j) = all previous dp scores. But if we add 1, then for each score in dp[i-1][all j] we add scores of special intervals ending at i and starting at index GE j. After this we remove excess elements from dp[i] and move to i+1.

I have implemented the same, but my code passes some tcs and not all. It would be very helpful if codechef community helps me detect bugs from my code.