板子(2) 链式前向星

· · 个人记录

链式前向星板子(感谢jca大佬)

int cnt, head[N];
struct edge { int v, nxt, w; } e[M];
inline void add(int u, int v, int w) { e[++cnt] = {v, head[u], w}; head[u] = cnt; }