问题,玄关
查看原帖
问题,玄关
516738
gaoleng_luogu_name楼主2023/12/6 21:14

rt,有没有大佬能用比较浅显的语言解释一下下面的代码?悬2关。

void add(int x,int y,int z) {
	ver[++tot] = y, edge[tot] = z;
	next[tot] = head[x], head[x] = tot;
}

for (int i = head[x]; i; i = next[i]{
	int y = ver[i], z = edge[i];
}
//知道是邻接表啦,只是想问一下怎么理解这段存储代码,蒟蒻不是很明白这几个数组的含义以及访问的原理。
2023/12/6 21:14
加载中...