This problem is solvable using fenwick aka Binary Index Tree?

Question : “https://cses.fi/problemset/task/1735
My code : “https://ideone.com/4nRq25

I know how to do range update and range query both operations using BIT (as above solution) , but in above question type 2 query says to set value ‘c’ to each index i which is lie between a to b . How can I do this ?

@ssjgz @rahulmysuru7 @navjeet0 @carre @udayan14 @galencolin @tmwilliamlin

I know how to increment by X in range from L to R , but how can I set X in range from L to R using BIT ?

I am seeing type 2 queries first time :sweat_smile:, I don’t think type 2 is BIT.

1 Like

Means not solvable by BIT , fr apna kaam khallas :frowning_face:

https://www.youtube.com/watch?v=dZ_6MS14Mg4&feature=youtu.be

see william lin’s method - time stamp 7hr 1min

Segment Tree , I saw already , but i wanna solve using BIT if possible :sweat_smile:

I would definitely go for a Seg Tree; maybe there’s a way of doing it using a couple of BITs but I don’t see any straightforward solution

2 Likes

But if possible please think :pray: