1 #include<bits/stdc++.h> 2 #define ll long long 3 #define scan(i) scanf("%d",&i) 4 #define scand(i) scanf("%lf",&i) 5 #define scanl(i) scanf("%lld",&i) 6 #define f(i,a,b) for(int i=a;i<=b;i++) 7 #define pb(i) push_back(i) 8 #define ppb pop_back() 9 #define pf printf 10 #define dbg(args...) cout<<#args<<" : "<<args<<endl; 11 #define input freopen("in.txt","r",stdin) 12 #define output freopen("out.txt","w",stdout) 13 #define io ios::sync_with_stdio(0) 14 #define fin freopen("in.txt","r",stdin) 15 using namespace std; 16 const int N=10005; 17 int head[N],cnt; 18 void init(){ 19 memset(head,-1,sizeof(head)); 20 cnt=0; 21 } 22 struct edge{ 23 int to,nxt,w; 24 }e[N<<1]; 25 void add(int u, int v, int w){ 26 e[cnt].to=v; 27 e[cnt].w=w; 28 e[cnt].nxt=head[u]; 29 head[u]=cnt++; 30 } 31 //for(int j=head[u]; j!=-1; j=e[j].nxt){ 32 // v=e[j].to;//u、v间连了边 33 // w=e[j].w;//边权为w 34 //} 35 int u,v,w;