题目大意:在滑雪场中,每一个景点有一个高度。现在小明在一号节点。i和j之间有单向边当且仅当i的高度不高于j。问小明最多可以去多少个景点,和最小总费用。
思路:这是一道数学证明的好题。
第一问比较水,直接将可行的边连接起来,然后BFS出解。
第二问就比较难搞了。不难看出,直接用朱刘算法是不可行的,因为朱刘算法的时间复杂度达到了O(mn),而这个题至少需要一个O(mlogm)的算法。
...
分类:
其他好文 时间:
2014-12-05 19:24:10
阅读次数:
198
mysql中常用的三种插入数据的语句:
insert into表示插入数据,数据库会检查主键(PrimaryKey),如果出现重复会报错;
replace into表示插入替换数据,需求表中有PrimaryKey,或者unique索引的话,如果数据库已经存在数据,则用新数据替换,如果没有数据效果则和insert into一样;
REPLACE语句会返回一个数,来指示受影响...
分类:
数据库 时间:
2014-12-05 17:27:29
阅读次数:
201
Follow up for "Unique Paths":Now consider if some obstacles are added to the grids. How many unique paths would there be?An obstacle and empty space i...
分类:
其他好文 时间:
2014-12-05 17:18:34
阅读次数:
121
1:创建全文索引而不运行完全填充 1 CREATE UNIQUE INDEX ui_ukDoc ON Production.Document(DocumentID); 2 CREATE FULLTEXT CATALOG AW_Production_FTCat; 3 CREATE FULLTEXT I...
分类:
其他好文 时间:
2014-12-05 16:53:47
阅读次数:
193
原文:http://favbulous.com/post/1001/24-unique-ios-login-screen-showcaseEeveEvernote FoodRecoodHipsterMingle!FlipboardShowyouFacebookPiictuFind Mt Friend...
分类:
移动开发 时间:
2014-12-05 07:03:01
阅读次数:
1276
题意:
Given n, how many structurally unique BST's (binary search trees) that store values 1...n?
For example,
Given n = 3, there are a total of 5 unique BST's....
分类:
其他好文 时间:
2014-12-04 21:38:52
阅读次数:
244
LoadRunner是怎么重复迭代和怎么增加并发运行的呢? 另外,在参数化时,对于一次压力测试中均只能用一次的资源应该怎么参数化呢?就是说这些资源用了一次就不能在用了的。 --参数化时,在select next row选择unique,update value on选择 each occuren.....
分类:
其他好文 时间:
2014-12-04 17:27:41
阅读次数:
197
Given an array S of n integers, are there elements a, b, c in S such that a + b + c = 0? Find all unique triplets in the array which gives the sum of zero.Note:Elements in a triplet (a,b,c) must be in...
分类:
其他好文 时间:
2014-12-04 12:08:48
阅读次数:
125
Given an arraySofnintegers, are there elementsa,b,cinSsuch thata+b+c= 0? Find all unique triplets in the array which gives the sum of zero.Note:Elemen...
分类:
其他好文 时间:
2014-12-04 00:38:06
阅读次数:
215
Given a stringS, find the longest palindromic substring inS. You may assume that the maximum length ofSis 1000, and there exists one unique longest pa...
分类:
其他好文 时间:
2014-12-03 23:15:35
阅读次数:
248