版本比较
CF1118F2
正文
增加 3 行删除 3 行
38 行未改动3940414243434445464727 行未改动75767778797980818283116 行未改动全部展开20020120220320420420520620720821 行未改动38 行未改动搞清楚这些就做完了,这边注意细节。
```cpp#include <bits/stdc++.h>#define int long long #define int long long#define pb push_backusing namespace std;const int INF=5e5+5;const int Mod=998244353;27 行未改动 return ;}int LCA(int x,int y) { if (dep[x]<dep[y]) swap(x,y); while (dep[x]!=dep[y]) while (dep[x]!=dep[y]) x=fath[x][__lg(dep[x]-dep[y])]; if (x==y) return x; int len=__lg(dep[x]); for (int i=len;~i;i--) {116 行未改动全部展开 for (int x=1;x<=n;x++) cnt.pb(find_set(x)); sort(cnt.begin(),cnt.end()); cnt.erase(unique(cnt.begin(),cnt.end()),cnt.end());
for (int x=1;x<=n;x++) { // cout<<x<<" "<<find_set(x)<<" kelkel\n"; if (a[x]) S::aa[Get(find_set(x))]=1; for (int i=head[x];i;i=edge[i].next_) {21 行未改动