随笔分类 -  算法模板

摘要:其实这题之前做过,线段树一直不熟,所以也一直没有搞懂 本题的关键是线段树原始区间代表的是每一种容器(size不同)的数量 比如 刚开始都是互不相关的,所以1的容器有n个 2 3 4。。。为0个 线段树每个结点的附加信息是该区间的和 本题查找出的代码是关键 比如左右子树分别为sum 27 25 ,则第 阅读全文
posted @ 2016-07-05 15:21 iEdson 阅读(298) 评论(0) 推荐(0)
摘要:IMMEDIATE DECODABILITY Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 12907 Accepted: 6188 Description An encoding of a set of symbols is 阅读全文
posted @ 2016-07-05 15:04 iEdson 阅读(236) 评论(0) 推荐(0)
摘要:最小生成树的定义:权值和最小的连通路 krus:每一步寻找原图最短路径(但是要安全边)加入 判断安全边可以用并查集 #include <iostream> #include <cstdio> #include <cstdlib> #include <cstring> #include <cmath> 阅读全文
posted @ 2016-06-15 01:23 iEdson 阅读(818) 评论(0) 推荐(0)
摘要:#include <iostream> #include <cstdio> #include <cstdlib> #include <cstring> #include <cmath> #include <stack> #include <string> #include <queue> #incl 阅读全文
posted @ 2016-06-10 15:04 iEdson 阅读(161) 评论(0) 推荐(0)
摘要:Halum You are given a directed graph G(V, E) with a set of vertices and edges. Each edge (i, j) that connects some vertex i to vertex j has an integer 阅读全文
posted @ 2016-05-24 18:33 iEdson 阅读(150) 评论(0) 推荐(0)
摘要:Find your present! Problem Description In the new year party, everybody will get a "special present".Now it's your turn to get your special present, a 阅读全文
posted @ 2016-05-13 19:22 iEdson 阅读(136) 评论(0) 推荐(0)
摘要:MPI Maelstrom Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 7850 Accepted: 4818 Description BIT has recently taken delivery of their new 阅读全文
posted @ 2016-05-07 21:26 iEdson 阅读(170) 评论(0) 推荐(0)
摘要:Sorting It All Out Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 31940 Accepted: 11103 Description An ascending sorted sequence of distin 阅读全文
posted @ 2016-05-05 20:51 iEdson 阅读(289) 评论(0) 推荐(0)
摘要:Network Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 11684 Accepted: 5422 Description A Telephone Line Company (TLC) is establishing a n 阅读全文
posted @ 2016-04-29 22:33 iEdson 阅读(341) 评论(0) 推荐(0)
摘要:Genealogical tree Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 4309 Accepted: 2866 Special Judge Description The system of Martians' blo 阅读全文
posted @ 2016-04-29 00:31 iEdson 阅读(169) 评论(0) 推荐(0)
摘要:脑子有点坑,不知道为什么,可能以前遇到阴影了,现在看到dfs暴力搜有种莫名的害怕,总结一下模板吧 这题还是没意思的,直接暴力搜,不过我写的很烂,可能就是这个原因吧,看了别人的模板,觉得不错。 学了个单词”lexicography“ 字典序,又吃了没文化的亏,wa一次 #include <iostre 阅读全文
posted @ 2016-04-26 23:55 iEdson 阅读(149) 评论(0) 推荐(0)
摘要:Oil Deposits Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 22543 Accepted Submission(s): 12980 阅读全文
posted @ 2016-04-25 23:45 iEdson 阅读(180) 评论(0) 推荐(0)
摘要:Asteroids! Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 4595 Accepted Submission(s): 2962 Inpu 阅读全文
posted @ 2016-04-25 19:22 iEdson 阅读(268) 评论(0) 推荐(0)
摘要:Tempter of the Bone Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 101603 Accepted Submission(s) 阅读全文
posted @ 2016-04-25 12:07 iEdson 阅读(135) 评论(0) 推荐(0)
摘要:hdu1238 暴力搜 Substrings Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 9122 Accepted Submission(s 阅读全文
posted @ 2016-04-24 17:42 iEdson 阅读(191) 评论(0) 推荐(0)
摘要:二分图的最大匹配问题n 二分图最小定点覆盖n hdu1150 DAG最小路径覆盖 m(节点数)-n 二分图最大独立子集 m-n //匈牙利算法模板 #include <iostream> #include <cstdio> #include <cstdlib> #include <cmath> #i 阅读全文
posted @ 2016-04-17 11:50 iEdson 阅读(166) 评论(0) 推荐(0)
摘要:原来这就是背包呀,好吧没看题解我没写出,不过之前做过这种,就是求多项式的系数,这种模板还是很好用的,以后记住吧 //01背包模板 #include <iostream> #include <cstdio> #include <cmath> #include <cstdlib> #include <a 阅读全文
posted @ 2016-04-12 18:03 iEdson 阅读(150) 评论(0) 推荐(0)
摘要:在第二种算法中,在计算每一个f(i)时,都要找出最大的f(j)(j<i)来,由于f(j)没有顺序,只能顺序查找满足aj<ai最大的f(j),如果能将让f(j)有序,就可以使用二分查找,这样算法的时间复杂度就可能降到O(nlogn)。于是想到用一个数组B来存储“子序列的”最大递增子序列的最末元素,即有 阅读全文
posted @ 2016-04-10 01:26 iEdson 阅读(445) 评论(0) 推荐(0)
摘要:dp[j] = max(dp[k]+1,dp[j])(0<k<j&a[j]>a[k]) #include <iostream> #include <cstdio> #include <cstring> #include <string> #include <stack> #include <queu 阅读全文
posted @ 2016-04-10 00:50 iEdson 阅读(114) 评论(0) 推荐(0)
摘要:int范围内的大数取得inf = 1<<31-1 int = 4e9 2^15 = 3e4 long = 1.8e19 自用头文件: #include <iostream> #include <cstdio> #include <cstdlib> #include <cstring> #includ 阅读全文
posted @ 2016-04-06 00:09 iEdson 阅读(125) 评论(0) 推荐(0)