(1)图论题双向边一般开两倍(有关边的数组);
(2)以图论为例的写法:
void add(int x,int y,int len){ nxt[++tot]=fst[x]; fst[x]=tot;//tot是指针,不能写成nxt[tot] w[tot]=len; to[tot]=y;
//双向边要多写这一行以下的 nxt[++tot]=fst[y]; fst[y]=tot; w[tot]=len; to[tot]=x;}