链式前向星 发表于 2021-11-11 更新于 2026-08-08 分类于 algorithm 本文字数: 33 阅读时长 ≈ 1 分钟 1234struct edge{int to,nxt,w;}e[N*2];int hd[N],tot=1;void add(int u,int v,int w){ e[++tot]=(edge){v,hd[u],w}; hd[u]=tot;}