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

no

Use Fenwick Trees instead of segment trees!

Just in case you haven’t checked it yet

2 Likes

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

a1*1-a2*2+a3*3-a4*4.......(-1)^(i+1)ai

ANd another fenwick trees having sum

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

thanx

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.

Loooooool

Lol I thought people have started discussing here😂