Looking for ideas (ZUBSPOIL)

I have been trying to solve this problem for a while now but I’ve ran out of ideas so maybe if anyone have any thoughts for the solution it would be of great help.

Cheers!

Hi @ryan312,

Same situation with me as well. I tried two different solutions, both of them are TLE. Most probably, my logic is correct. At least the basic test cases mentioned in the problem page are succeeding. I need to improve the time complexity.

I am not sure if making use of Fenwick tree data-structure is useful to solve this problem.

Thanks