发现这个说的比较通俗:假设存在一个序列d[1..9] = 2 1 5 3 6 4 8 9 7,可以看出来它的LIS长度为5。下面一步一步试着找出它。我们定义一个序列B,然后令 i = 1 to 9 逐个考察这个序列。此外,我们用一个变量Len来记录现在最长算到多少了首先,把d[1]有序地放到B里,令...
分类:
其他好文 时间:
2014-08-15 20:50:19
阅读次数:
364
本题是LIS题解。主要是理解他的题意。他的题意都好像比较隐晦,比如每个poor city和rich city一定是需要对应起来的,比如poor city和rich city并不是按顺序给出的。
其实是可以把数列按照poor city排序,然后求rich city城市号的最大递增子序列。
不过这里不用排序,利用hash的思想直接对应起来就可以了。
然后就是本题是卡DP的O(n*n)的解法的,这...
分类:
其他好文 时间:
2014-08-15 17:55:49
阅读次数:
211
Problem Description
JGShining's kingdom consists of 2n(n is no more than 500,000) small cities which are located in two parallel lines.
Half of these cities are rich in resource (we call them ri...
分类:
其他好文 时间:
2014-08-14 01:37:07
阅读次数:
237
先上题目:12661 Funny Car RacingThere is a funny car racing in a city with n junctions and m directed roads.The funny part is: each road is open and closed...
分类:
其他好文 时间:
2014-08-13 21:55:38
阅读次数:
340
题意:给出n个村庄之间的距离,再给出已经连通起来了的村庄。求把所有的村庄都连通要修路的长度的最小值。思路:Kruskal算法课本代码://Kruskal算法#includeusing namespace std;int fa[120];int get_father(int x){ return fa...
分类:
其他好文 时间:
2014-08-13 14:21:16
阅读次数:
212
Jungle RoadsTime Limit:1000MSMemory Limit:10000KTotal Submissions:19265Accepted:8806DescriptionThe Head Elder of the tropical island of Lagrishan has ...
分类:
其他好文 时间:
2014-08-12 21:48:04
阅读次数:
182
Dark roads
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 583 Accepted Submission(s): 253
Problem Description
Economic times th...
分类:
其他好文 时间:
2014-08-11 21:26:42
阅读次数:
208
Constructing Roads
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 13995 Accepted Submission(s): 5324
Problem Description
There ...
分类:
其他好文 时间:
2014-08-10 21:40:41
阅读次数:
276
Problem DescriptionThe Head Elder of the tropical island of Lagrishan has a problem. A burst of foreign aid money was spent on extra roads between vil...
分类:
其他好文 时间:
2014-08-06 18:02:11
阅读次数:
275
http://acm.hdu.edu.cn/showproblem.php?pid=1025
Constructing Roads In JGShining's Kingdom
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 1...
分类:
其他好文 时间:
2014-08-05 19:26:50
阅读次数:
270