Segment Tree Problem from SPOJ, SEGSQRSS — Sum of Squares with Segment Tree

Revision en2, by Tobby_And_Friends, 2016-10-21 22:52:23

Problem Link: http://www.spoj.com/problems/SEGSQRSS/

While I do understand that the merge operation can be deduced from the equation (a + b)^2 = a^2 + b^2 — 2ab I could not specifically figure out how would I formulate the merge operation. Any help is really appreciated.

Tags spoj, segment tree

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en2 English Tobby_And_Friends 2016-10-21 22:52:23 58 Tiny change: 'While I do' -> 'Problem Link: http://www.spoj.com/problems/SEGSQRSS/\n\nWhile I do'
en1 English Tobby_And_Friends 2016-10-21 22:05:32 299 Initial revision (published)