优先队列头文件#include 默认优先为从大到小优先。自定义优先级 1 struct cmpmin{ //按从小到大 2 3 // 因为标准库默认使用元素类型的b; //所以规定小的元素...
分类:
其他好文 时间:
2014-10-28 00:24:09
阅读次数:
243
Given an index k, return the kth row of the Pascal's triangle. For example, given k = 3,Return [1,3,3,1].Note:Could you optimize your algorithm to use...
分类:
其他好文 时间:
2014-10-27 17:33:44
阅读次数:
223
问题描述:
Given an index k, return the kth row of the Pascal's triangle.
For example, given k = 3,
Return [1,3,3,1].
Note:
Could you optimize your algorithm to use only O(k) extra space?
思路:
...
分类:
其他好文 时间:
2014-10-26 11:46:08
阅读次数:
251
http://acm.hdu.edu.cn/showproblem.php?pid=2870
Largest Submatrix
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 1569 Accepted Submissi...
分类:
其他好文 时间:
2014-10-26 01:39:00
阅读次数:
213
题目:给你一个n*n的01矩阵,求里面最大的1组成的矩形的米娜及。
分析:dp,单调队列。UVa 1330同题,只是输入格式变了。
我们将问题分解成最大矩形,即求解以k行为底边的图形中的最大矩形,然后合并,求最大的矩形;
预处理: 求出以每行为底边的每一列从底边开始向上的最大连续1的高度MaxH。 O(N^2) ;
...
分类:
其他好文 时间:
2014-10-24 22:19:16
阅读次数:
267
Find the contiguous subarray within an array (containing at least one number) which has the largest sum.For example, given the array[?2,1,?3,4,?1,2,1,...
分类:
其他好文 时间:
2014-10-24 18:14:41
阅读次数:
180
Find the contiguous subarray within an array (containing at least one number) which has the largest product.
For example, given the array [2,3,-2,4],
the contiguous subarray [2,3] has the largest pr...
分类:
编程语言 时间:
2014-10-24 13:01:16
阅读次数:
222
Find the contiguous subarray within an array (containing at least one number) which has the largest product.For example, given the array[2,3,-2,4],the...
分类:
其他好文 时间:
2014-10-24 10:26:11
阅读次数:
269
链接:http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&category=25&problem=2299&mosmsg=Submission+received+with+ID+14404690
题意:一个有向图,找一个最大的点集使得任意两点u、v间都存在一条路(单向或双向)...
分类:
其他好文 时间:
2014-10-23 16:25:21
阅读次数:
205
水题,晒一遍素数并标注就OK了。
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#define INF 0x7fffffff
#define eps 1e-8
#define LL long long...
分类:
其他好文 时间:
2014-10-23 12:33:57
阅读次数:
136