Hello guys can anyone help me with this problem . Does this require some type of data structure ??
This problem can be solved with segment tree with lazy propagation!!
try implementing it if you stuck then here is my implementation https://www.codechef.com/viewsolution/15429966
As raman suggested, this problem is to be solved with Segment Trees with Lazy Propagation technique.
I have used and modified an implementation for this question which is very beginner-friendly so if you want you can take a look ( this was my segment tree question as well).
Also, if you wanna learn about segment trees I would recommend the video tutorials from Tushar Roy
ok @raman3217 I will implement it