摘要:
一开始提交了这个,果断TLE 1 #include 2 #include 3 #include 4 #include 5 #include 6 #include 7 #include 8 using namespace std; 9 10 #define MEM(a,v) memset... 阅读全文
摘要:
http://acm.hdu.edu.cn/showproblem.php?pid=2433这个问题因为路径都是1,所以可以用bfs遍历可以看这几篇文章讲解:http://blog.csdn.net/panyanyany/article/details/7215069(这篇代码非常清晰,而且效率很高... 阅读全文
摘要:
这道题也是死命TLE。。http://acm.hdu.edu.cn/showproblem.php?pid=2680 1 /* 2 使用pair代替结构 3 */ 4 5 #include 6 #include 7 #include 8 #include 9 using namespace... 阅读全文
摘要:
http://acm.hdu.edu.cn/showproblem.php?pid=2544 1 /* 2 使用pair代替结构 3 */ 4 5 #include 6 #include 7 #include 8 #include 9 using namespace std;10 cons... 阅读全文
摘要:
优先队列那里用greater会报错http://acm.hdu.edu.cn/showproblem.php?pid=1874 1 /* 2 使用pair代替结构 3 */ 4 5 #include 6 #include 7 #include 8 #include 9 using name... 阅读全文
摘要:
这道题怎么都是TLE,报警了,先放在这http://acm.hdu.edu.cn/showproblem.php?pid=1596 1 #include 2 #include 3 using namespace std; 4 5 #define MAXVEX 1001 6 7 double ... 阅读全文
摘要:
有向图强连通分量:在有向图G中,如果两个顶点vi,vj间(vi>vj)有一条从vi到vj的有向路径,同时还有一条从vj到vi的有向路径,则称两个顶点强连通(strongly connected)。如果有向图G的每两个顶点都强连通,称G是一个强连通图。有向图的极大强连通子图,称为强连通分量(stron... 阅读全文
摘要:
Kruskal算法是一种用来寻找最小生成树的算法,由Joseph Kruskal在1956年发表。用来解决同样问题的还有Prim算法和Boruvka算法等。三种算法都是贪婪算法的应用。和Boruvka算法不同的地方是,Kruskal算法在图中存在相同权值的边时也有效。时间复杂度:elog2e e为图... 阅读全文
摘要:
里姆算法(Prim算法),图论中的一种算法,可在加权连通图里搜索最小生成树。意即由此算法搜索到的边子集所构成的树中,不但包括了连通图里的所有顶点(英语:Vertex (graph theory)),且其所有边的权值之和亦为最小。介绍如下:http://baike.baidu.com/link?url... 阅读全文
摘要:
DFS(Depth-First-Search)深度优先搜索算法,是搜索算法的一种。是一种在开发爬虫早期使用较多的方法。它的目的是要达到被搜索结构的叶结点 。介绍如下:http://baike.baidu.com/link?url=-Qr8pxnyPEe03J07nhRELWcTFjhY4CDPwNn... 阅读全文