Given a two-dimensional array of positive and negative integers, a sub-rectangle is any contiguous sub-array of size 1*1 or greater located within th....
分类:
其他好文 时间:
2014-08-05 13:38:49
阅读次数:
218
可以发现 当第i-1个比第i个高的时候 比第i-1个高的所有也一定比第i个高
于是可以用到动态规划的思想
令left[i]表示包括i在内比i高的连续序列中最左边一个的编号 right[i]为最右边一个的编号
那么有 当h[left[i]-1]>=h[i]]时 left[i]=left[left[i]-1] 从前往后可以递推出left[i]
同理 当h[right[i]+1]>=h[i]]时 right[i]=right[right[i]+1] 从后往前可递推...
分类:
其他好文 时间:
2014-08-05 09:39:49
阅读次数:
276
Problem Description
A histogram is a polygon composed of a sequence of rectangles aligned at a common base line. The rectangles have equal widths but may have different heights. For example, the fi...
分类:
其他好文 时间:
2014-08-01 09:16:21
阅读次数:
280
import java.awt.Image; import java.awt.Rectangle; import java.awt.geom.AffineTransform; import java.awt.image.AffineTransformOp; import java.awt.image...
分类:
编程语言 时间:
2014-07-31 16:14:36
阅读次数:
338
DescriptionGiven a two-dimensional array of positive and negative integers, a sub-rectangle is any contiguous sub-array of size 1 x 1 or greater locat...
分类:
其他好文 时间:
2014-07-31 02:38:55
阅读次数:
292
Problem Description
Given an N * M matrix with each entry equal to 0 or 1. We can find some rectangles in the matrix whose entries are all 1, and we define the maximum area of such rectangle as thi...
分类:
移动开发 时间:
2014-07-30 20:48:34
阅读次数:
260
这个问题姑且也叫做最大子矩阵吧给一个树状图,求一个最大面积的子矩阵思路是这样的,对于每个单位矩阵,求出左边连续不比它低的矩阵的下标,放在l数组里同样,再求出右边连续的不比它低的矩阵的下标这样,对于每个单个矩阵所能得到的最大面积就是(r[i]-l[i]+1)*a[i] 1 //#define LOCA...
分类:
其他好文 时间:
2014-07-29 20:54:32
阅读次数:
158
题目:Given a 2D binary matrix filled with 0's and 1's, find the largest rectangle containing all ones and return its area.题解:这道题可以应用之前解过的Largetst Recta....
分类:
编程语言 时间:
2014-07-26 09:55:57
阅读次数:
301
题目:Given n non-negative integers representing the histogram's bar height where the width of each bar is 1, find the area of largest rectangle in the ....
分类:
编程语言 时间:
2014-07-26 09:53:57
阅读次数:
273
hdu1506:http://acm.hdu.edu.cn/showproblem.php?pid=1506题意:给你一些直的的方块,这些方块的底部在同一条直线上,但是高度不一样,让你找一个最大的方块,这个方块是由这些矩阵拼起来的。题解:自己太渣了,完全不会这一题怎么写,发现自己的思维能力太弱了,根...
分类:
其他好文 时间:
2014-07-26 01:21:47
阅读次数:
237