CF264E Roadside Trees
Description
Squirrel Liss loves nuts. Liss asks you to plant some nut trees.
There are $ n $ positions (numbered 1 to $ n $ from west to east) to plant a tree along a street. Trees grow one meter per month. At the beginning of each month you should process one query. The query is one of the following types:
1. Plant a tree of height $ h $ at position $ p $ .
2. Cut down the $ x $ -th existent (not cut) tree from the west (where $ x $ is 1-indexed). When we cut the tree it drops down and takes all the available place at the position where it has stood. So no tree can be planted at this position anymore.
After processing each query, you should print the length of the longest increasing subsequence. A subset of existent trees is called an increasing subsequence if the height of the trees in the set is strictly increasing from west to east (for example, the westmost tree in the set must be the shortest in the set). The length of the increasing subsequence is the number of trees in it.
Note that Liss don't like the trees with the same heights, so it is guaranteed that at any time no two trees have the exactly same heights.
Input Format
N/A
Output Format
N/A
Explanation/Hint
States of street after each query you can see on the following animation:
If your browser doesn't support animation png, please see the gif version here: http://212.193.37.254/codeforces/images/162/roadtree.gif