Hello everyone. I started to learn segment tree and i choose codeforces EDU section's Segment Tree problems. I need help for (https://codeforces.me/edu/course/2/lesson/4/3/practice/contest/274545/problem/E) problem. Here is my solution: https://codeforces.me/edu/course/2/lesson/4/3/practice/contest/274545/submission/338162999
can you help me to fix this.
UPD: fixed. Thanks all.








I can't see the problem, can you post it here?
We have array initially filled by zeros. and we have two types of operation:
1 l r v -> add the value v to the segment from l to r [l, r] 2 i -> find the value of the element with index i.
Can't see your code. sry plz post it.
you should learn lazy tag or this is O(n^2)
seems like a difference array. in that case, you should do:
add(l) and add(r), not add(l+1) and add(r+1)
It seems like I can't see your submission, but did you use just a segment tree or a lazy propagation segment tree?
Just segment tree
Then that might be why. Looking at the problem, you have to use a version of segment trees called lazy propagation segment trees (or lazy prop).
just don't update when r == n
Thanks a lot sir.