#include<bits/stdc++.h> using namespace std; const int maxn=1e6+10; int n,m; struct edge{ int v,w,nxt; }; edge e[maxn]; int head[maxn]; int cnt=0,s; int dis[maxn]; struct node{ int id,dis; bool operator <(const node &a)const{ return dis>a.dis; } }; void add(int from,int to,int w){//链...