树和图的存储 memset(h, -1, sizeof h); int h[N], e[M], ne[M], idx; void add(int a, int b) { e[idx] = b, ne[idx] = h[a], h[a] = idx ++ ; }