记得edge数组开大点
be like:
struct Edge{ int next,to,w,from; }edge[N],ed[N];
改为:
struct Edge{ int next,to,w,from; }edge[N<<2],ed[N<<2];