//youwu #include #include #include #include #include using namespace std; const int N=3e4+5,N3=15e4+5,inf=0x3f3f3f3f; int to[N3],ne[N3],w[N3],h[N],cnt=0,s=N-4,e,dist[N]; bool in[N],wa=0,u,v,w1; int n,m,maxn=0; void add(int u,int v,int w1) { to[++cnt]=v; ne[cnt]=h[u]; w[cnt]=w1; h[u]=cnt; } void spfa() { stackq;//queue没有自带函数清零 q.push(s); while(!q.empty()) { int u=q.top(); q.pop(); in[u]=0;//spfa的精髓!! for(int i=h[u];i;i=ne[i]) { int v=to[i],w1=w[i]; // printf("%d %d %d\n",u,v,w1); if(dist[u]+w1maxn) // { // maxn=dist[i]; // } // } printf("%d",dist[n]); return 0; }