版本比较
题解 P3703 【[SDOI2017]树点涂色】
正文
增加 3 行删除 3 行
89 行未改动90919293949495969798129 行未改动全部展开22822923023123223223323423523610 行未改动2472482492502512512522532542558 行未改动89 行未改动 freopen("s.in", "r", stdin);#endif
int m, x, y, z;
input(n), input(m); FOR(i, 2, n) input(x), input(y), Add(x, y);
col_now = n;129 行未改动全部展开 Modify(1, 1, n, f[__lp], g[__lp], 1); toplastc = __lp; } } if(f[r] < f[top[x]]) if(f[r] < f[top[x]]) nl = f[top[x]], nr = g[top[x]], x = fa[top[x]]; else nl = f[r], nr = g[r], x = fa[r], col_top[c] = toplastc; }10 行未改动 return Ask(1, 1, n, f[x], g[x]);}
int LCA(int x, int y) { while(top[x] != top[y]) while(top[x] != top[y]) if(deep[top[x]] > deep[top[y]]) __lp = top[x], x = fa[top[x]]; else __lq = top[y], y = fa[top[y]]; if(x == y) return x; if(deep[x] < deep[y]) return __lq = son[x], x;8 行未改动