Karafs is some kind of vegetable in shape of an 1?×?h rectangle. Tavaspolis people love Karafs
and they use Karafs in almost any kind of food. Tavas, himself, is crazy about Karafs.
Each Karafs...
分类:
其他好文 时间:
2015-04-16 23:46:24
阅读次数:
211
给定从左到右多个矩形,已知这此矩形的宽度都为1,长度不完全相等。这些矩形相连排成一排,求在这些矩形包括的范围内能得到的面积最大的矩形,打印出该面积。所求矩形可以横跨多个矩形,但不能超出原有矩形所确定的范围。l[i]表示大于等于h[i]的最左边的位置,r[i]表示大于等于h[i]的最右边的位置,这样可以预处理出l[],r[],然后ans = max(ans, r[i] - l[i] + 1) * h[...
分类:
其他好文 时间:
2015-04-16 21:59:32
阅读次数:
187
题目地址:http://acm.csu.edu.cn/OnlineJudge/problem.php?id=1553#include #include #include using namespace std;int main(){ long long int a[10005],n,k; ...
分类:
其他好文 时间:
2015-04-16 21:36:35
阅读次数:
99
先用ST预处理一下,做到可以O(1)得到[l,r]最值 然后枚举块的长度,在枚举每个块,这样的复杂度就是n/1+n/2+n/3+...+n/n n有20W,这个前面这个式子的值差不多又240W,复杂度可以接受。。 另外一开始想到一个做法,二分答案,但是经证实这样的的确确是错的 1 #i...
分类:
其他好文 时间:
2015-04-15 00:52:08
阅读次数:
138
DescriptionNow ,there are some rectangles. The area of these rectangles is 1* x or 2 * x ,and now you need find a big enough rectangle( 2 * m) so that...
分类:
其他好文 时间:
2015-04-14 23:10:48
阅读次数:
143
problem:
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 histogram.
Above is a histo...
分类:
其他好文 时间:
2015-04-14 16:45:49
阅读次数:
88
problem:
Given a 2D binary matrix filled with 0's and 1's, find the largest rectangle containing all ones and return its area.
Hide Tags
Array Hash
Table Stack Dynamic
Programmin...
分类:
其他好文 时间:
2015-04-14 16:40:04
阅读次数:
110
DescriptionFor sequence i1, i2, i3, … , iN, we set aj to be the number of members in the sequence which are prior to j and greater to j at the same ti...
分类:
其他好文 时间:
2015-04-13 20:49:57
阅读次数:
108
题目链接:maximal-rectangle
import java.util.Arrays;
/**
* Given a 2D binary matrix filled with 0's and 1's,
* find the largest rectangle containing all ones and return its area.
*
*/
public cl...
分类:
其他好文 时间:
2015-04-12 13:28:40
阅读次数:
189
Given a 2D binary matrix filled with 0's and 1's, find the largest rectangle containing all ones and return its area.
题意:求0,1矩阵中,1构成的最大矩阵。
思路:借用了上一题,首先我们先计算出dp[i][j]表示到第i行第j列时,此时这一列的连续1的个数,然后计算每一行...
分类:
其他好文 时间:
2015-04-12 10:37:34
阅读次数:
118