Have you ever played DOTA? If so, you may know the hero, Invoker. As one of the few intelligence carries, Invoker has 10 powerful abilities. One of them is the Ice Wall: Invoker generates a wall of solid ice directly in front of him, and the bitter c…
HDU 6187 Destroy Walls (思维,最大生成树) Destroy Walls *Time Limit: 8000/4000 MS (Java/Others) Memory Limit: 132768/132768 K (Java/Others) Total Submission(s): 1784 Accepted Submission(s): 692 * Problem Description Long times ago, there are beautiful histor…
Floyd Floyd 本质上类似一种动态规划,dp [ i ] [ j ] = dp [ i ] [ k ] + dp[ k ] [ j ]. /** * Night gathers, and now my watch begins. * It shall not end until my death. * I shall take no wife, hold no lands, father no children. * I shall wear no crowns and win no g…
Destroy Walls Long times ago, there are beautiful historic walls in the city. These walls divide the city into many parts of area. Since it was not convenient, the new king wants to destroy some of these walls, so he can arrive anywhere from his cast…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=6187 题意:有一个V个结点M条边的带边权无向平面图,有一个人在一个区域,要拆一些墙使得他可以到达任意一个区域,问最小花费. 解法: #include <bits/stdc++.h> using namespace std; const int maxn = 100010; const int maxm = 200010; struct edge{ int u,v,w; edge(){} bool…
题目大意 给出一个有向图(可能存在重边),求从\(S\)到\(F\)最短路的条数,如果次短路的长度仅比最短路的长度多1,那么再加上次短路的条数. 输入格式 第一行是数据组数\(T\). 对于魅族数据,第一行是\(n\)和\(m\),表示节点数和边数. 接下来\(m\)行,每行三个整数\(a\),\(b\),\(l\),表示\(a\rightarrow b\)有一条边,长度为\(l\). 最后两个整数表示\(S\)和\(F\). 输出格式 对于每组数据输出一个答案\(ans\). 数据范围 \(2…
转自:http://blog.csdn.net/shahdza/article/details/7779273 最短路 [HDU] 1548 A strange lift基础最短路(或bfs)★2544 最短路 基础最短路★3790 最短路径问题基础最短路★2066 一个人的旅行基础最短路(多源多汇,可以建立超级源点和终点)★2112 HDU Today基础最短路★1874 畅通工程续基础最短路★1217 Arbitrage 货币交换 Floyd (或者 Bellman-Ford 判环)★124…
出处:http://blog.csdn.net/shahdza/article/details/7779273 最短路 [HDU] 1548    A strange lift基础最短路(或bfs)★ 2544    最短路  基础最短路★ 3790    最短路径问题基础最短路★ 2066    一个人的旅行基础最短路(多源多汇,可以建立超级源点和终点)★ 2112    HDU Today基础最短路★ 1874    畅通工程续基础最短路★ 1217    Arbitrage   货币交换…
纯最短路. ///HDU 2544堆优化的最短路 #include <cstdio> #include <iostream> #include <sstream> #include <cmath> #include <cstring> #include <cstdlib> #include <string> #include <vector> #include <map> #include <…
***************************************转载请注明出处:http://blog.csdn.net/lttree*************************************** 最短路 Time Limit: 5000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 28761    Accepted Submissio…