
图负环spfa
aiworenyanzhousuanfa
生于忧患,死于安乐
展开
-
洛谷 P2850 [USACO06DEC]虫洞Wormholes spfa 负环
题目链接:https://www.luogu.org/problemnew/show/P2850思路:1:spfa判断负环2:当某个点松弛超过n次后,便可以说明有负环#include <bits/stdc++.h>using namespace std;const int maxn=501;vector<pair<int,int> >...原创 2019-07-15 16:16:28 · 242 阅读 · 0 评论 -
洛谷 P3385 【模板】负环 spfa 负环
题目链接:https://www.luogu.org/problemnew/show/P3385思路:1:spfa判断负环2:当某个点松弛超过n次后,便可以说明有负环#include <bits/stdc++.h>using namespace std;const int maxn=2001;vector<pair<int,int> &g...原创 2019-07-15 16:59:46 · 275 阅读 · 0 评论