版本比较
浅谈 OI 中各种合并操作
正文
增加 7 行删除 7 行
45 行未改动4647484950505152535452 行未改动10710810911011111111211311411542 行未改动158159160161162162163164165166198 行未改动全部展开365366367368369369370371372373373374375376377108 行未改动全部展开48648748848949049049149249349435 行未改动53053153253353453453553645 行未改动 #define puts(x) IO::Puts(x) template<typename T> inline void read(T&x){ for(f=1,c=getchar();c<48||c>57;c=getchar())f^=c=='-'; for(x=0;c<=57&&c>=48;c=getchar()) x=(x<<1)+(x<<3)+(c&15); for(x=0;c<=57&&c>=48;c=getchar()) x=(x<<1)+(x<<3)+(c&15); x=f?x:-x; } template<typename T> inline void write(T x){52 行未改动 return R-L+1;}struct Node{ __gnu_pbds::gp_hash_table<int,int> cnt;//出现次数 hhx lwx; hhx lwx;}chifan[maxn];__gnu_pbds::gp_hash_table<int,int> xzy;inline void insert(int pos,int x,bool type){ ++chifan[pos].cnt[x];42 行未改动 for(int v1:X){ s+=chifan[v1].lwx.size(); if(s>=pos){ v=v1; break; break; } } wyb.push_back(chifan[v].lwx.rd()); }198 行未改动全部展开 dfs1(nxt,now); }}int LCA(int x,int y){ if(depth[x] < depth[y]) if(depth[x] < depth[y]) swap(x, y); while(depth[x] > depth[y]) x=fa[x][lg[depth[x]-depth[y]]- 1]; if(x==y) if(x==y) return x; for(int k=lg[depth[x]]-1; k>=0; --k) if(fa[x][k] != fa[y][k]) x=fa[x][k],y=fa[y][k];108 行未改动全部展开 } swap(trie[cur].ls,trie[cur].rs); if(trie[cur].ls!=0) trie[trie[cur].ls].v=0; if(trie[cur].rs!=0) if(trie[cur].rs!=0) trie[trie[cur].rs].v=1; add(trie[cur].ls,pos); pushup(trie[cur].ls,pos); pushup(trie[cur].rs,pos);35 行未改动 edge[i].push_back(v); edge[v].push_back(i); } dfs(1,0); cout<<anser; cout<<anser;}```