https://codeforces.me/contest/877/problem/F
That is the problem. This problem is solved by MO. I have understood whole thing. But I couldn't understand while we are moving our pointer to the left we are counting the values for (+ k) and when we are moving our pointer to the right we are counting the values for (- k). Can anyone tell me why we are not counting the (- k) values while moving our pointer to the left and why we are not counting (+ k) values while we are moving our pointer to the right?
My question is when we are moving our pointer to the left we are supposed to add the value for + k and — k and for right pointer the same thing should be happened. Why we are not doing this?
Can anyone help me regarding this? Thank you