本文共 592 字,大约阅读时间需要 1 分钟。
#includeusing namespace std;typedef long long ll;const int maxn=3e5+1;int n,m,k,u,v,w,x[maxn],y[maxn],cnt=0;ll d[maxn],num[maxn];bool vis[maxn];vector >g[maxn<<1];void spfa(int x){ memset(vis,false,sizeof(vis)); for(int i=0;i<=n;++i) d[i]=1e18,num[i]=0; d[x]=0;num[x]=1; queue q; q.push(x); vis[x]=true; while(!q.empty()) { int top=q.front(); q.pop(); vis[top]=false; for(auto v:g[top]) { if(d[top]+v.second 1) num[x[i]]--,cnt++; } printf("%d\n",cnt);}
转载地址:http://rqewz.baihongyu.com/