Differential (depth of understanding)

I had always thought that the difference is so easy

Prefix and a difference according to directly defined as the difference before and after a number of array columns of two ( please ignore its own two-dimensional )

The amount, the result is a two-dimensional run into a face slap

Differential become abnormal abstract

Very difficult to understand,

Hou Hou, I'll just say under their own understanding

First, the difference is a technical term, do not think to do the difference (in fact, is to do bad, but not good writing code, and very abstract)

I am more than happy as it is a process

This line of small print should be no one sees it. .

That is, to define its own behavior

It has such summation interval addition and the interval subtraction so nature

Imagine if we involve multiple queries, it is best to use the tree line or Fenwick tree but did not mention

But it does not require multiple queries, he was just a segment tree without multiple queries Bale

We can make the fastest modify, query the appropriate bit slower does not matter

Optimization method to modify what ah:

Then you will certainly be shouting: lazy mark (segment tree does not learn it)

I do not know it does not matter, we do not need to know this stuff labeled lazy, long thought to know

I thought : something to satisfy the range of addition and subtraction, when we update, just replace the updated order, the final result is always the same

Easy to find when we repeat the operation involves a number of updates, so we can first make a mark, meaning not updated, the answer to the last update operations (addition and subtraction of privilege interval)

Mark is to do what we did not do during a marking, update! !

In this case it is not difficult to make a difference

A dimensional difference : is a marker lazy ADD, somewhere in the array ADD, meaning that this number includes the number of the latter not updated with the value of the ADD;

Therefore, we have interval (x, y) plus a value of k, we can make the x ADD + = k, y + at 1 ADD- = k; the results thus generated is finally removed mark, (x, y ) + = k, and y is behind another offset ADD

This realization of the interval plus, we can not keep up another array of ADD, because it is updated in order, which is not normal becomes ADD code (online stuffing)

 

Two-dimensional differential : ADD lower right can be started from this position all positions plus ADD, this can be combined as follows: sections and rectangular. . . . . . (1)

       May be started from a lower right position of the diagonal lines are coupled ADD, this may be combined: triangular (complex (1))

     Of course, we can arbitrarily define ADD achieve different effects, when they want to test

Of course, according to this we can also come up with their own three-dimensional differential something like it

Code is not up, and who will be the thing (escape

No one sees this line of small print it. . . .

Guess you like

Origin www.cnblogs.com/zrqlj/p/11298861.html