Help needed. Spoj — IQUERY — Interesting queries

Правка en1, от shakil.ahamed, 2017-09-12 23:51:53

Problem: http://www.spoj.com/problems/IQUERY/

I think we can use segment tree for this problem. I figured out that the multiplication and addition part has the following property: mul(i, j) = mul(i, k)+mul(k+1, j)+mul(i, k)*mul(k+1, j) where i <= k <= j. So, this is easy to do with range trees.

But as bitwise and is not distributive over addition we can't define the second type of query as the previous one. Anyone approached the problem?

Any hint will be appreciated.

Теги spoj, bitwise

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en2 Английский shakil.ahamed 2017-09-12 23:53:12 10
en1 Английский shakil.ahamed 2017-09-12 23:51:53 534 Initial revision (published)