借鉴自:https://blog.youkuaiyun.com/qq_30331643/article/details/68621435 写的贼好理解
struct Edge{
int next,to,w;
}edge[maxn*maxn];
int cnt=0,head[maxn],len[maxn];
void addEdge(int u,int v,int w)
{
edge[cnt].to=v;
edge[cnt].w=w;
edge[cnt].next=head[u];
head[u]=cnt++;
}