[12.4] Diary

12.4 diary

CDQ partition

  1. HDU1541: a given number (a, b), the definition (a, b) level to satisfy (a2 <= a && b2 <= b) is (a2, b2) number. The output level is the number of stars is 0-n-1.

Two-dimensional partial order bare title. The first sorted, the second dimension Fenwick tree can be.

Note : Fenwick tree can not deal with the subscript is zero, so you need to +1. Directly or discrete. Discrete time, attention int len = unique (a + 1 , a + n + 1) -a-1;

Segment tree

  1. HDU4578: + subtraction interval interval interval multiplied by + modify + range and ask a quadratic cubic.

I tm cry, debug the day. Since it is modulo, so lazy [id] [3] In the absence of marker value to be set to -1, with 0 not determined.

Ideas : Modify the highest priority, followed by multiplication, addition and subtraction last. Every pushdown first judge to modify, if not modified further multiplication and subtraction. When the value of each modification, the 123 all-time modifications.

Monotone data structure

  1. POJ2559: width of the N parallel rectangle 1, seeking to select a rectangular shape, the largest area.

Thinking : can the greedy, the largest area to the i-th rectangle is the largest template that can select is smaller than the first distance left his position and right of the first smaller than his position * h [i], the first stack monotonous the first obtaining a smaller number than either side of him, and finally sweep again, are \ (O (n) \) is.

But for such a minimum * Title maximum interval length interval can directly monotonically stack processing.

  1. POJ3494: 01 to a matrix, seeking the largest sub-matrices.

Thinking : really wonderful, sweeping every rampant, in fact, the equivalent of doing n times and a maximum rectangular area.

  1. POJ2796: for the minimum and maximum range interval *.

Ideas : and POJ2559 the same, but here turned into a zone and, seeking prefix and sets the stack can be monotonous. Essentially seek the minimum value of each of the maximum transfer interval.

to sum up

Today tune the segment tree tune in ...... 1w served, later on a long lesson, not all the time can be used to determine whether there is a 0, particularly in the case of modulo. Also learned monotonous stack some of the basic applications, mainly around first to find the most value, and thus be able to find the maximum range of the current value of the minimum (and CF1073G in qz approach to the Lord, and look back to fix this problem after all, it is time to write your own ugly).

Tomorrow Plan

Tomorrow is a busy, tree line forward in time a rush, CDQ bare two-dimensional and three-dimensional partial orders of partially ordered wrote.

Guess you like

Origin www.cnblogs.com/diorvh/p/11986681.html
Recommended