最短路
cwb丶
这个作者很懒,什么都没留下…
展开
-
dijk的堆优化
复习了最小生成树和最短路对于prim和dijk的算法复杂度都是o(n*n)堆优化可以复杂度降为o((n+m)*log(m))因此对于点数很多的稀疏图有较大的优化作用dijk的堆优化 算法而对于点数较少的图来说则无太大的优化作用如图上面是堆优化的disjk对于小根堆的使用https://blog.csdn.net/xiaoquantouer/article/de...原创 2019-03-01 15:42:33 · 1288 阅读 · 0 评论 -
Path(2019 杭电多校第一场 ) hdu 6582(最短路模板+dinic模板)
PathTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 262144/262144 K (Java/Others)Total Submission(s): 2452Accepted Submission(s): 677Problem DescriptionYears later, Jerry fell in ...原创 2019-07-25 12:36:16 · 140 阅读 · 0 评论 -
In Touch(dijk+并查集优化)
There are n soda living in a straight line. soda are numbered by1,2,…,n1,2,…,nfrom left to right. The distance between two adjacent soda is 1 meter. Every soda has a teleporter. The teleporter ofii...原创 2019-07-30 09:30:49 · 178 阅读 · 0 评论 -
Subway POJ - 2502 (最短路)
You have just moved from a quiet Waterloo neighbourhood to a big, noisy city. Instead of getting to ride your bike to school every day, you now get to walk and take the subway. Because you don't want ...原创 2019-03-24 10:28:55 · 213 阅读 · 0 评论 -
NEAU 2019积分赛第五场 题目订正
G-String ProblemBoy Valera likes strings. And even more he likes them, when they are identical. That's why in his spare time Valera plays the following game. He takes any two strings, consisting ...原创 2019-03-23 18:11:00 · 130 阅读 · 0 评论 -
Candies POJ - 3159 (差分约束 spfa+stack)
During the kindergarten days, flymouse was the monitor of his class. Occasionally the head-teacher brought the kids of flymouse’s class a large bag of candies and had flymouse distribute them. All the...原创 2019-03-22 16:08:43 · 137 阅读 · 0 评论 -
nvitation Cards POJ - 1511 (双向堆优化dijk)
N cases. The first line of the input contains only positive integer N. Then follow the cases. Each case begins with a line containing exactly two integers P and Q, 1 <= P,Q <= 1000000. P is the...原创 2019-03-18 19:27:35 · 147 阅读 · 0 评论 -
Arbitrage POJ - 2240 (spfa 初体验)
Arbitrage is the use of discrepancies in currency exchange rates to transform one unit of a currency into more than one unit of the same currency. For example, suppose that 1 US Dollar buys 0.5 Britis...原创 2019-03-18 18:05:13 · 122 阅读 · 0 评论 -
Cow Contest POJ - 3660 (弗罗伊得算法的应用)
N(1 ≤N≤ 100) cows, conveniently numbered 1..N, are participating in a programming contest. As we all know, some cows code better than others. Each cow has a certain constant skill rating that is un...原创 2019-03-17 21:17:55 · 211 阅读 · 0 评论 -
POJ - 1860 (BELLMAN_FORD)(判断负权边)Currency Exchange
Several currency exchange points are working in our city. Let us suppose that each point specializes in two particular currencies and performs exchange operations only with these currencies. There can...原创 2019-03-15 20:57:37 · 108 阅读 · 0 评论 -
关于最短路算法的学习
对prim算法和dijk算法搞混了归根结底还是对算法的理解不够透彻先写一道变型dijk算法Freddy Frog is sitting on a stone in the middle of a lake. Suddenly he notices Fiona Frog who is sitting on another stone. He plans to visit her, but...原创 2019-03-14 11:14:12 · 149 阅读 · 0 评论 -
最短路 2 (百度之星 初赛3 B)(floyd)
小 A 是社团里的工具人,有一天他的朋友给了他一个nn个点,mm条边的正权连通无向图,要他计算所有点两两之间的最短路。作为一个工具人,小 A 熟练掌握着 floyd 算法,设w[i][j]w[i][j]为原图中(i,j)(i,j)之间的权值最小的边的权值,若没有边则w[i][j]=w[i][j]=无穷大。特别地,若i=ji=j,则w[i][j]=0w[i][j]=0。F...原创 2019-08-26 18:58:12 · 261 阅读 · 0 评论