![](https://img-blog.csdnimg.cn/20201014180756922.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
最短路
weixin_44040169
这个作者很懒,什么都没留下…
展开
-
最短路总结
本来以为自己不用总结回头再看这几种算法都忘光了QAQ如果存在一个环(从某个点出发又回到自己的路径),而且这个环上所有权值之和是负数,那这就是一个负权环,也叫负权回路Floyd算法适合解决多源最短路复杂度最高解决负边(负权)但不能解决负环void Floyd()//Floyd{ int i,j,k; for(k=1;k<=n;k++) { ...原创 2019-11-28 21:14:41 · 111 阅读 · 0 评论 -
AOE网上的关键路径(Bellman-Ford)
数据结构实验之图论十一:AOE网上的关键路径Time Limit: 2000 ms Memory Limit: 65536 KiBProblem Description一个无环的有向图称为无环图(Directed Acyclic Graph),简称DAG图。AOE(Activity On Edge)网:顾名思义,用边表示活动的网,当然它也是DAG。与AOV不同,活动都表示在了边上,如下图所...原创 2019-11-28 19:21:43 · 115 阅读 · 0 评论 -
H - Weekend (floyd+next_permutation函数)
H - Weekend Gym - 101020HYou and your friends are going to camping next weekend , because you are the best driver and you are living in this town for ten years , you have to drive the car from your h...原创 2019-08-17 14:50:36 · 183 阅读 · 0 评论 -
I - Arbitrage(正权回路+map映射)
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-08-15 21:06:11 · 77 阅读 · 0 评论 -
E - Currency Exchange(Bellman_Ford判断正权回路)
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-08-15 19:19:19 · 98 阅读 · 0 评论 -
F - Wormholes(判断负权回路 spfa)
While exploring his many farms, Farmer John has discovered a number of amazing wormholes. A wormhole is very peculiar because it is a one-way path that delivers you to its destination at a time that i...原创 2019-08-15 16:04:56 · 136 阅读 · 0 评论 -
B - Frogger(floyd)C - Heavy Transportation(dijstra)
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 since the water is dirty and full of tourists’ sun...原创 2019-08-15 10:59:59 · 124 阅读 · 0 评论 -
最短路径
最短路径Time Limit: 1000 ms Memory Limit: 65536 KiBSubmit StatisticProblem Description为了准备一年一度的校赛,大家都在忙着往赛场搬运东西,比如气球什么的。这时 YY 也没有闲着,他也加入了搬运工的行列。已知学校有 N 个路口和 M 条路,YY 并不是把东西直接搬到赛场,而是从 S 路口搬运到 T 路口。由于 YY...原创 2019-08-14 16:32:09 · 120 阅读 · 0 评论 -
C. MRT Map(spfa,前向星)
C. MRT Maptime limit per test3.0 smemory limit per test256 MBinputstandard inputoutputstandard outputAlaa and Duaa spent a long day in Universal Studios in Sentosa island, and now it’s time to go...原创 2019-08-09 20:58:08 · 480 阅读 · 0 评论 -
D - Silver Cow Party
D - Silver Cow PartyOne cow from each of N farms (1 ≤ N ≤ 1000) conveniently numbered 1…N is going to attend the big cow party to be held at farm #X (1 ≤ X ≤ N). A total of M (1 ≤ M ≤ 100,000) unidir...原创 2019-08-19 11:30:47 · 116 阅读 · 0 评论 -
人活着系列之芳姐和芳姐的猪(floyd)
人活着系列之芳姐和芳姐的猪Time Limit: 1000 ms Memory Limit: 65536 KiBSubmit StatisticProblem Description百年来,人活着是为了什么这个问题一直萦绕在人的脑海里,也一直困扰着人的思想。人活着就是活着了,为活着本身而活着,而不是为活着之外的任何事物而活着的。正因为活着,所以活着。对,是有点莫明其妙,但也是一句最受用的话...原创 2019-08-08 20:13:07 · 300 阅读 · 0 评论 -
C--最短路(spfa,前向星)
C–最短路Time Limit: 7000 ms Memory Limit: 65536 KiBSubmit StatisticProblem Description给出一个带权无向图,包含n个点,m条边。求出s,e的最短路。保证最短路存在。Input多组输入。对于每组数据。第一行输入n,m(1<= n && n<=510^5,1 <= m &am...原创 2019-08-08 20:10:38 · 158 阅读 · 0 评论