spfa最短路+判负权回路(是否某个点入队超过n次). #include<cstdio> #include<queue> #include<cstring> using namespace std; #define M 20001 #define N 1001 int n,m,x,y,w1,w2; int v[M],en,cnt[N],dis[N],w[M],first[M],next[M]; bool inq[N]; queue<int>q; void A…
L - Subway(最短路spfa) You have just moved from a quiet Waterloo neighbourhood to a big, noisy city. Instead of getting to ride your bike to school every day, you now get to walk and take the subway. Because you don't want to be late for class, you want…