POJ 3259 Wormholes(SPFA)】的更多相关文章

http://poj.org/problem?id=3259 题意 : 农夫约翰农场里发现了很多虫洞,他是个超级冒险迷,想利用虫洞回到过去,看再回来的时候能不能看到没有离开之前的自己,农场里有N块地,M条路连接着两块地,W个虫洞,连接两块地的路是双向的,而虫洞是单向的,去到虫洞之后时间会倒退T秒,如果能遇到离开之前的自己就输出YES,反之就是NO. 样例解释 : 2 3 3 1 1 2 2 1 3 4 2 3 1 3 1 3 3 2 1 1 2 3 2 3 4 3 1 8 第一行中的2代表有两组…
Wormholes Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 42366 Accepted: 15560 传送门 Description 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 p…
( ̄▽ ̄)" #include<iostream> #include<cstdio> #include<queue> #include<vector> #include<cstring> #include<algorithm> using namespace std; const int INF=10e7; ; int f,n,m,w,s,e,t; int lc[MAXN],cntNode[MAXN]; bool vis[M…
http://poj.org/problem?id=3259 题意:有一些普通的洞和虫洞,每个洞都有经过的时间,虫洞的时间是负的,也就是时光倒流,问是否能回到出发时的时间. 思路: 贝尔曼-福特算法判断负环. #include<iostream> #include<algorithm> #include<string> #include<cstring> #include<set> #include<map> using namesp…
POJ 3259 Wormholes(最短路径,求负环) Description 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 is BEFORE…
题目链接:http://poj.org/problem?id=3259 Wormholes Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 45077   Accepted: 16625 Description While exploring his many farms, Farmer John has discovered a number of amazing wormholes. A wormhole is ver…
Wormholes Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 24249   Accepted: 8652 Description 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 pa…
Wormholes Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 36729   Accepted: 13444 Description 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 p…
题意:给你m条路花费时间(双向正权路径),w个虫洞返回时间(单向负权路径),问你他能不能走一圈回到原点之后,时间倒流. 思路:题意有点难看懂,我们建完边之后找一下是否存在负权回路,存在则能,反之不能.判断负权回路可以用一个cnt,这个spfa板子里有. 代码: #include<cstdio> #include<set> #include<vector> #include<cmath> #include<queue> #include<cs…
Description 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 is BEFORE you entered the wormhole! Eac…