
spfa
threeh20
暑假有半个月整个人像死了一样,所以更加明白生命的可贵
展开
-
hdu 1535 Invitation Cards
http://acm.hdu.edu.cn/showproblem.php?pid=1535#includeusing namespace std;int u[11111111];int v[11111111];int w[11111111];int first[11111111];int ne原创 2017-09-30 11:59:27 · 241 阅读 · 0 评论 -
hdu 1142 A Walk Through the Forest
http://acm.split.hdu.edu.cn/showproblem.php?pid=1142#includeusing namespace std;struct r{ int ed,va;};r road[1111];vector po[1111];int dp[1111],dis[1111];bool原创 2017-10-06 04:02:35 · 196 阅读 · 0 评论 -
fzu 2243 Daxia like uber
http://acm.fzu.edu.cn/problem.php?pid=2243#include #include #include #include #include #includeusing namespace std;const int inf=0x3f3f3f3f;const int M=1005;struct node原创 2017-11-11 20:57:25 · 250 阅读 · 0 评论 -
Poj2449 Remmarguts' Date(SPFA+第k短路+A*)
http://poj.org/problem?id=2449根据A*f(p)=g(p)+h(p)g(p)就是p点到s点最短距离h(p)就是p点到t点的距离h(p)的求法就是将边反过来求一遍单源最短路即可。为什么要用A*?A*的作用就是将普通的bfs变得更加智能,我们可以通过改变h函数来达到我们希望的效果。这道题,我们要求第K短路,那么怎么去求呢。思路就是利用A*,将较短的路径上的点放在前面去跑。这...原创 2018-07-10 10:10:35 · 188 阅读 · 0 评论 -
POJ 3013 - Big Christmas Tree(最短路spfa)
http://poj.org/problem?id=3013原创 2018-07-10 11:18:52 · 169 阅读 · 0 评论 -
poj 3621 Sightseeing Cows(01划分+spfa)
http://poj.org/problem?id=3621关于01划分问题https://blog.youkuaiyun.com/gengmingrui/article/details/47443705这个blog讲的已经很清楚了 受益良多用spfa是为了判负权环,如果一个点被压入栈中超过n次,就代表有一个负权环路。做题中遇到了一些问题:1 poj上交题需要选择C++而不是 G++可能在双精度运算上有误...原创 2018-07-13 11:47:13 · 224 阅读 · 0 评论 -
牛客国庆集训派对Day1 L New Game!(最短路spfa)
https://www.nowcoder.com/acm/contest/201/L 差一点就在一条错误的方向越走越远了 竟然是最短路 太强了 #include<bits/stdc++.h>using namespace std;const int maxn=1e3+10;const int N=1e6+100;const int inf=0x3f3...原创 2018-10-02 18:47:22 · 160 阅读 · 0 评论