struct node{
int pre;// 表示前一个边
int to,cost;// 边的指向节点和边权
}e[maxm<<1];
int id[maxn],cnt;//id 始终表示建图后节点所存储的最后一条边, cnt 是链上节点的个
数
void add(int from,int to,int cost)
{
e[cnt].to = to;
e[cnt].cost = cost;
e[cnt].pre = id[from];
id[from] = cnt++;
}
void init(){
memset(id,-1,sizeof(id));
cnt = 0;
}
评论0