Kickstart 2020 round C problem C and D

if you are able to solve any of them plz explain

hello i solved Problem D but they show me error TLE. i dont why ??
should i post my code ?
i written the code in python 3


Use Fenwick Trees instead of segment trees!

Just in case you haven’t checked it yet

My easy solution!

simple D solution using fenwick trees

A subtle Hint of :- D

Make 2 fenwick trees one storing some till ith element as


ANd another fenwick trees having sum

a1 - a2 + a3 - a4…n in fenwick trees or prefix trees


If anyone used maps(instead of array) in problem C and DID NOT get TLE in 2nd subtask, then please share the code.

My Java Solution

Please don’t post questions of live contests.


Lol I thought people have started discussing here😂