with height h.(h<=10) Type2: Cut the x-th tree from west.(x<=10) After each query, you should calculate the length of LIS of height of tree(from west to east). Before each query, trees grow 1 meter. N: The number of trees ≦ 10^5 M: The number of queries ≦ 2*10^5
h at time t, you should plant a tree with height h-t instead. Then you can ignore the growth of the trees. And plot trees on a x-y plane: x-coordinate is the position and y-coordinate is the modified height (h-t).
increasing sequence that starts from the point. The value written on point p = (the maximal value written in the rectangle whoselower-left corner is p) + 1. 1 1 1 2 2 3 4 y x
will be one of the ten points that have the smallest y-coordinate. To process this query, erase all values written below the new point first and rewrite the values to those points from top to bottom. Solution 1 1 1 2 2 3 4 y x
will be one of the ten points that have the smallest x-coordinate. So you can erase all values written on those points and rewrite correct values from right to left. Solution 1 1 1 2 2 3 4 y x
the point whose x-coordinate is x and non-leaf nodes of the segment trees have the maximum of children of the node. Define segy similarly. Solution 1 1 1 2 2 3 4 y x