正文
增加 9 行删除 9 行
116 行未改动全部展开11711811912012112212312412512614 行未改动14114214314414514614714814914 行未改动1641651661671681691701711721731741751761771781791805 行未改动1861871881891901911921931947 行未改动2022032042052062072082092108 行未改动2192202212222232242252262277 行未改动23523623723823924024124224330 行未改动116 行未改动全部展开int v = j.first, w = j.second;if (v == fa || is[v] != is[u]) continue;dpt[v] = dpt[u] + w;dfs2 (v, u);siz[u] += siz[v];}return;}inline void dfs3 (const int rt1, const int rt2, const int u, const int fa) {14 行未改动// dfs4 (v, u);// }// is[u] = idx;// return;//}inline void build (register int u, const int sum, const int fa) {Fa[u] = fa;Dpt[u] = Dpt[fa] + 1;14 行未改动// for (auto j : g[u]) {// int v = j.first;// if (v == fa || is[v] != is[u]) continue;// ++ idx;//// }if (b[u].size() == 1) update (u, 1, 0);else {int x = b[u].rbegin();b[u].erase(x);update (u, 1, x + b[u].rbegin());b[u].insert(x);}return;}inline void insert (const int x) {5 行未改动int y = b[x].rbegin();b[x].erase(y);update (x, 1, y + b[x].rbegin());b[x].insert(y);}while (u) {update (u, 1, -1e9);if (!F[Dpt[u]][lst].size() || D[Dpt[u]][x] > F[Dpt[u]][lst].rbegin()) {if (F[Dpt[u]][lst].size()) b[u].erase(F[Dpt[u]][lst].rbegin());7 行未改动int x = b[u].rbegin();b[u].erase(x);update (u, 1, x + b[u].rbegin());b[u].insert(x);}lst = u;u = Fa[u];}return;8 行未改动int y = b[x].rbegin();b[x].erase(y);update (x, 1, y + b[x].rbegin());b[x].insert(y);}while (u) {update (u, 1, -1e9);if (F[Dpt[u]][lst].rbegin() == D[Dpt[u]][x]) {if (F[Dpt[u]][lst].size()) b[u].erase(F[Dpt[u]][lst].rbegin());7 行未改动int x = b[u].rbegin();b[u].erase(x);update (u, 1, x + b[u].rbegin());b[u].insert(x);}lst = u;u = Fa[u];}return;30 行未改动116 行未改动全部展开11711811912012112212312412512614 行未改动14114214314414514614714814914 行未改动1641651661671681691701711721731741751761771781791805 行未改动1861871881891901911921931947 行未改动2022032042052062072082092108 行未改动2192202212222232242252262277 行未改动23523623723823924024124224330 行未改动116 行未改动全部展开int v = j.first, w = j.second;if (v == fa || is[v] != is[u]) continue;dpt[v] = dpt[u] + w;dfs2 (v, u);siz[u] += siz[v];}return;}inline void dfs3 (const int rt1, const int rt2, const int u, const int fa) {14 行未改动// dfs4 (v, u);// }// is[u] = idx;// return;//}inline void build (register int u, const int sum, const int fa) {Fa[u] = fa;Dpt[u] = Dpt[fa] + 1;14 行未改动// for (auto j : g[u]) {// int v = j.first;// if (v == fa || is[v] != is[u]) continue;// ++ idx;//// }if (b[u].size() == 1) update (u, 1, 0);else {int x = b[u].rbegin();b[u].erase(x);update (u, 1, x + b[u].rbegin());b[u].insert(x);}return;}inline void insert (const int x) {5 行未改动int y = b[x].rbegin();b[x].erase(y);update (x, 1, y + b[x].rbegin());b[x].insert(y);}while (u) {update (u, 1, -1e9);if (!F[Dpt[u]][lst].size() || D[Dpt[u]][x] > F[Dpt[u]][lst].rbegin()) {if (F[Dpt[u]][lst].size()) b[u].erase(F[Dpt[u]][lst].rbegin());7 行未改动int x = b[u].rbegin();b[u].erase(x);update (u, 1, x + b[u].rbegin());b[u].insert(x);}lst = u;u = Fa[u];}return;8 行未改动int y = b[x].rbegin();b[x].erase(y);update (x, 1, y + b[x].rbegin());b[x].insert(y);}while (u) {update (u, 1, -1e9);if (F[Dpt[u]][lst].rbegin() == D[Dpt[u]][x]) {if (F[Dpt[u]][lst].size()) b[u].erase(F[Dpt[u]][lst].rbegin());7 行未改动int x = b[u].rbegin();b[u].erase(x);update (u, 1, x + b[u].rbegin());b[u].insert(x);}lst = u;u = Fa[u];}return;30 行未改动