随笔分类 - D 数据结构 - 并查集
摘要:一开始的做法是,我就简单地以为是最短路的变式,只不过是累加变成累按位或 然后。。。就喜提 55pts 感觉很假,也不多说什么了 code #include <bits/stdc++.h> #define re register int using namespace std; typedef lon
阅读全文
摘要:原理 在线维护集合的合并和查询 int find(int x) { return fa[x] == x ? x : fa[x] = find(fa[x]); } void merge(int x, int y) { fa[find(x)] = find(y); } 时间复杂度 运用 题单 1. P6
阅读全文