#include#include int head[100100];//表头,head[i]代表起点是i的边的编号int cnt;//代表边的编号struct s{ int u;//记录边的起点 int v;//记录边的终点 int w;//记录边的权值 int next;//指向上一条边的编号}edge[100010];void add(int u,int v,int w)//向所要连接的表中加入边{ edge[cnt].u=u; edge[cnt].v=v; edge[cnt].w=w; edge[cnt].next=head[u]; head[u]=cnt++;}int main(){ int n; while(scanf("%d",&n)!=EOF) { int i; cnt=0; memset(head,-1,sizeof(head));//清空表头数组 for(i=0;i
来着——非我非非我大佬的博客