正文
增加 5 行删除 5 行
12 行未改动131415161718192021161 行未改动全部展开1831841851861871881891901911921931941951961971981992002012022032042052062072083 行未改动12 行未改动4. [Milk Vists S](https://www.luogu.com.cn/problem/P5836#submit) WA了一次,因为忘记特判两个点在一起。5. [Closing the Farm](https://www.luogu.com.cn/problem/P6121) 离线倒序。6. [MooTube](https://www.luogu.com.cn/problem/P4185) 一开始没想出来倒序(完全倒过来)有啥用,但是后来想到离线可以随便排序,然后降序一排就A了。(边写成升序了卡了三分钟)7. [团伙](https://www.luogu.com.cn/problem/P1892) 拆成俩。8. [食物链](https://www.luogu.com.cn/problem/P2024) 一开始没有想好拆出来的三种点之间的关系。161 行未改动全部展开if (h == 1)q[i].v = l[p];elseq[i].v = r[p];if (h == 1)ql[p] = true;elseqr[p] = true;}init();for (int i = 1; i <= n; i++) {if (!ql[i] && l[i] != -1)unn(i, l[i], 0);if (!qr[i] && r[i] != -1)unn(i, r[i], 0);}for (int i = m; i >= 1; i--)unn(q[i].u, q[i].v, i);for (int i = 1; i <= n; i++) {fnd(i);cout << d[i] - 1 << endl;}3 行未改动12 行未改动131415161718192021161 行未改动全部展开1831841851861871881891901911921931941951961971981992002012022032042052062072083 行未改动12 行未改动4. [Milk Vists S](https://www.luogu.com.cn/problem/P5836#submit) WA了一次,因为忘记特判两个点在一起。5. [Closing the Farm](https://www.luogu.com.cn/problem/P6121) 离线倒序。6. [MooTube](https://www.luogu.com.cn/problem/P4185) 一开始没想出来倒序(完全倒过来)有啥用,但是后来想到离线可以随便排序,然后降序一排就A了。(边写成升序了卡了三分钟)7. [团伙](https://www.luogu.com.cn/problem/P1892) 拆成俩。8. [食物链](https://www.luogu.com.cn/problem/P2024) 一开始没有想好拆出来的三种点之间的关系。161 行未改动全部展开if (h == 1)q[i].v = l[p];elseq[i].v = r[p];if (h == 1)ql[p] = true;elseqr[p] = true;}init();for (int i = 1; i <= n; i++) {if (!ql[i] && l[i] != -1)unn(i, l[i], 0);if (!qr[i] && r[i] != -1)unn(i, r[i], 0);}for (int i = m; i >= 1; i--)unn(q[i].u, q[i].v, i);for (int i = 1; i <= n; i++) {fnd(i);cout << d[i] - 1 << endl;}3 行未改动