生命算法,以防忘记 #include<bits/stdc++.h> using namespace std; int head[200005],dis[200005],n,m,s,f,g,w,l; bool sign[200005]; struct node { int to,next,val; } a[200005]; inline void in(int from,int to,int v) { a[++l].next=head[from]; a[l].to=to; a[l].val=v;…