|
|
|
@ -13,9 +13,8 @@ void dfs(int u, int x) { // x 表示起点
|
|
|
|
|
dis[x][u] = cnt, dis[u][x] = cnt;
|
|
|
|
|
cnt++;
|
|
|
|
|
for (int i = 1; i <= e[u][0]; i++) { // 枚举子节点
|
|
|
|
|
if (st[e[u][i]] == 0) {
|
|
|
|
|
dfs(e[u][i], x);
|
|
|
|
|
}
|
|
|
|
|
if (st[e[u][i]]) continue;
|
|
|
|
|
dfs(e[u][i], x);
|
|
|
|
|
}
|
|
|
|
|
cnt--; // 退回上一个节点,要记得把距离减去一
|
|
|
|
|
}
|
|
|
|
|