-------------------------------------------- not can not do the question, since I was determined to become a Piece, if this has died, then it does not matter.
Following a previous section, the line continues to explore Shuya!
How to use the tree line interval statistics?
It is assumed that the number 13 is 1,2,3,4,1,2,3,4,1,2,3,4,1. (A [1] = 1, A [2] = 2, ... ... a [13] = 1) after the section of the section marked with numbers and:
Hee hee, here's another question:
How to modify the point?
Pictured above a basis for discussion:
Assume that the A [6] + = 7, take a look at what intervals need to be modified? [6], [5,6], [5,7], [1,7], [1,13] all these intervals need +7. All remaining sections do not move.
Thus, Fengyun segment tree, the modified point modified segment tree up to five elements (one for each layer).
Below, the modified elements are shown in blue.
One fought three thousand miles, and to pursue the storage structure of the tree line:
所以线段树需要的空间是n的两倍到四倍之间的某个数,一般就开4*n的空间就好,如果空间不够,可以自己算好最大值来省点空间。