TLE with fenwick tree

Revision en1, by Sohsoh84, 2020-06-08 11:19:17

Hi :), I was solving 1278D - Segment Tree, I looped over all 2n cells once and I did an O(1) process inside the loop, then I looped again over them and in each index, I called either "Update" or "Sum" method of a Fenwick tree with size MAXN(about 1e6 in this problem), I think the final time complexity is going to be O(N log N) and my code should pass test cases with this time complexity, but I've got TLE on test 15

am I doing something wrong so it caused an undefined behavior ?? or Fenwick tree isn't good for this problem ??

My code: 83112181

and sorry for my bad English :)

Tags #fenwick tree


  Rev. Lang. By When Δ Comment
en1 English Sohsoh84 2020-06-08 11:19:17 618 Initial revision (published)