tag是假的,用了及其诡异的方法判负环 正权无向边和负权有向边的图 #include<iostream> #include<cstdio> #include<cstring> using namespace std; const int N=505,inf=210000000; int n,m,w,h[N],cnt,d[N]; struct qwe { int ne,to,va; }e[N*N]; int read() { int r=0,f=1; char p=get…
[题目链接] https://www.lydsy.com/JudgeOnline/problem.php?id=1715 [算法] 用SPFA判定负环是否存在即可 时间复杂度 : O(N ^ 2) [代码] #include<bits/stdc++.h> using namespace std; #define MAXN 500010 const int inf = 2e9; struct edge { int to , w , nxt; } e[MAXN]; int n , m , p ,…