Here you will find solutions of many problems on spoj. If you want solution of some problem which is not listed in blog or have doubt regarding any spoj problem (which i have solved) or any programming concept (data structure) you can mail me @ raj.nishant360@gmail.com

And my humble request to you all that don't copy the code only try to understand the logic and algorithm behind the code. I have started this because if you tried as hard as you can and still can't find any solution to the problem then you can refer to this.
You can read my answer how to start competitive programming CLICK HERE

Friday, October 16, 2015

SEGSQRSS-Sum of Squares with Segment Tree

Sum of Squares with Segment Tree

Given below c++ code is for segsqrss spoj or sum of squares with segment tree spoj.

Main logic of code is within Merge and Split function in class 'node'




2 comments:

  1. i tried running your code in Coding Ninja it gives WA for 1 Test case

    ReplyDelete
  2. hmm, your code goes wrong in this test case:
    1
    3 10
    1 6 2

    1 1 2 5
    0 3 3 5
    0 2 2 10
    1 1 1 2
    2 3 3
    0 1 3 6
    0 1 3 7
    2 2 2
    2 3 3
    1 1 1 2

    I think something went wrong in your code :>.
    Sr for my poor english

    ReplyDelete

Your comment is valuable to us