Analog Test 55

T1:

  Interval great, but where the best position possible no more than $ 2n $ months.

  Interval end and the optimal value possible may be discrete, i.e., each interval $ l $, $ r $ and $ r + 1 $, $ 1 $ together with the discretization.

  Then you can segment tree maintenance.

  To while maintaining the leftmost $ 0 $ and $ 1 $, whether the current range are all full or $ 1 $ 0 $ to $.

  If the interval is modified assignment, covering direct answer and lazy mark.

  If the interval is inverted, switching the left-most position of $ 0 and $ $ $ 1, while the inverting area condition mark and lazy.

  Query leftmost to $ 0 $.

  Time complexity $ O (nlogn) $.

T2:

  The article is divided into four categories: Like A, B like, and the like do not like.

  Each case is sorted, then choose an enumeration of like how many.

  So everyone likes to be selected and B, respectively, the smallest number is like the total number equal to k.

  And then the rest of all the things put into the tree line where a few small value before the inquiry and.

  To maintain a dynamic segment tree deletions complexity.

  Time complexity $ O (nlogn) $.

T3:

  For each point as follows:
    reverse order not enumerate each side, only initially set themselves.

    If the two are in the collection, the current point must be eaten, the end of the return;

    If one of the points in the set, a set of expansion;

    If two points are not in the collection, what effect did not, recursively.

    Recursive the end, the point can survive.

  This is a collection of case on behalf of the survival of the current point needs to be eaten on its behalf point.

  Enumeration two points, two points if the collection intersect, it can not survive at the same time, on the contrary can.

  Time complexity $ O (nm) $.

Guess you like

Origin www.cnblogs.com/hz-Rockstar/p/11619517.html