HDU 1505 - City Game

Problem : Find the maximum area rectangle on a N*M grids, with some grid cannot be occupied by the rectangle.
Solution : Denote f[i][j], that the area of rectangle start from grid (i, j) and stretch to uper-most, then stretch horizontally to the two side until it cannot stretch at all. The largest rectangle must be one of the rectangles represented by f, otherwise the largest rectangle can be enlarged. With (i, j)'s uper-most height calculated, f[i][j] can be get in O(m) time, thus it costs O(nm^2) time. However, by using monotone stack, using O(m) time can get all the f value at i-th row, thus the time can be reduced to O(nm).
HDU 1506 - Largest Rectangle In a Histogram

Problem : Given a histogram, find a largest area rectangle in it.
Solution : RAW monotone stack problem. Denote f[i] to be largest rectangle passes i and with height a[i]. f can be calculated in O(n) time by using monotone stack.
Note : The property of monotone stack is: if the element on top of the stack is not ended calculating, so does the elements below it.
Merge branch 'master' of github.com:MissAmour/KrwlngsACMFile