Блог пользователя KIMJONGOOF

Автор KIMJONGOOF, история, 6 часов назад, По-английски

I tried attempting CSES Prefix Sum Queries using lazy segment tree.

My Solution

Can someone explain to me exactly why my logic fails??

*Edit -> I realized that I was not changing the values in the original array and so I included that in the solution and it still fails -> Solution

  • Проголосовать: нравится
  • -1
  • Проголосовать: не нравится

»
6 часов назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Auto comment: topic has been updated by KIMJONGOOF (previous revision, new revision, compare).

»
5 часов назад, # |
Rev. 2   Проголосовать: нравится 0 Проголосовать: не нравится

I didn't get your seg tree implementation, but here's my code if it helps. Even I used segment tree.

»
84 минуты назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Here is my code CSES code and i recommend you to check this blog by a code red Segment tree tutorial,the segment tree in the blog can eazy solve a lot of commutative problem like max,min,sum,gcd... but if you want to solve some problem with order matter like this problem,you need to research for a while how can do this,actually when i first time learn segment tree from the blog i can't solve some problem like prefix sum queries/subarray sum queries but if you have a more deep understanding about the segment tree,you will see that the segment tree in the blog is absolutely beast,good luck to you