版本比较
题解:P10851 [EGOI 2024] Make Them Meet / 活动面基
正文
增加 8 行删除 8 行
80 行未改动8182838485868788899091929315 行未改动10911011111211311411511611792 行未改动21021121221321421521621721828 行未改动24724824925025125225325425526 行未改动2822832842852862872882892904 行未改动2952962972982993003013023035 行未改动80 行未改动if (j == u[i] || j == v[i]) cout << 1 << ' ';else cout << 0 << ' ';}cout << '\n';}exit(0);}}namespace Sub2 {int h[N], e[N * N * 2], ne[N * N * 2], idx;void add(int a, int b) {e[idx] = b, ne[idx] = h[a], h[a] = idx++;}15 行未改动if (!op && !is[i]) continue;if (j == father) continue;if (vis[j]) continue;dep[j] = dep[x] + 1;dfs(j, x, S, S1, op);}}int c[N];void work(int rt, int son, int son1, int op) {92 行未改动for (int i = h[x]; ~i; i = ne[i]) {if (!is[i]) continue;int j = e[i];if (j == fa) continue;find(j, x);}}void solve(int rt) {cnttt = 0;28 行未改动int j = e[i];solve(j);}}for (int i = h[w]; ~i; i = ne[i]) {if (!is[i]) continue;int j = e[i];if (j == fa[w]) continue;bool f = 1;26 行未改动ban[j] = 0;cnttt--;For(i, 0, n - 1) if (ban[i]) assert(in[i] <= 2);work(j, w, last, 1);}assert(0);}}int main() {4 行未改动For(i, 1, m) cin >> u[i] >> v[i];Sub1::work();Sub2::solve(0);return 0;}/*5 40 10 25 行未改动80 行未改动8182838485868788899091929315 行未改动10911011111211311411511611792 行未改动21021121221321421521621721828 行未改动24724824925025125225325425526 行未改动2822832842852862872882892904 行未改动2952962972982993003013023035 行未改动80 行未改动if (j == u[i] || j == v[i]) cout << 1 << ' ';else cout << 0 << ' ';}cout << '\n';}exit(0);}}namespace Sub2 {int h[N], e[N * N * 2], ne[N * N * 2], idx;void add(int a, int b) {e[idx] = b, ne[idx] = h[a], h[a] = idx++;}15 行未改动if (!op && !is[i]) continue;if (j == father) continue;if (vis[j]) continue;dep[j] = dep[x] + 1;dfs(j, x, S, S1, op);}}int c[N];void work(int rt, int son, int son1, int op) {92 行未改动for (int i = h[x]; ~i; i = ne[i]) {if (!is[i]) continue;int j = e[i];if (j == fa) continue;find(j, x);}}void solve(int rt) {cnttt = 0;28 行未改动int j = e[i];solve(j);}}for (int i = h[w]; ~i; i = ne[i]) {if (!is[i]) continue;int j = e[i];if (j == fa[w]) continue;bool f = 1;26 行未改动ban[j] = 0;cnttt--;For(i, 0, n - 1) if (ban[i]) assert(in[i] <= 2);work(j, w, last, 1);}assert(0);}}int main() {4 行未改动For(i, 1, m) cin >> u[i] >> v[i];Sub1::work();Sub2::solve(0);return 0;}/*5 40 10 25 行未改动