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

Автор MrDepomposition, история, 7 лет назад, По-английски

hello i am writing this blog because i asked a question but havent got asnwer for it, please explain me why do we need to use segment tree to calculate sums, why cant we just use c++ operator + (read more about this operator here — https://www.w3schools.com/cpp/cpp_operators.asp)

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

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

I hope you're kidding

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

The + operator in general won't give you the sum of an array over an index range [l...r] in log(N) time. A segment tree will.

»
7 лет назад, скрыть # |
 
Проголосовать: нравится -8 Проголосовать: не нравится

i am trying to solve this problem — https://codeforces.me/problemset/problem/409/H?locale=ru
but my segment tree solution fails

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

Its big brain time!