随笔分类 - 并查集
摘要:并查集基本处理即可。 cpp include include include include using namespace std; define int long long const int MAXN = 100001; struct edge { int u; int v; int w; b
阅读全文
摘要:题意:带温度最短路。 思路: 我们将温度从小到大的将边加入,用并查集维护连通性。 如果一旦联通那么跑一遍$spfa$就可以得到答案。 复杂度$O(m log m)$ c++ include using namespace std; define ll long long const int maxn
阅读全文
摘要:思路: 并查集按秩合并维护出现时间。 最早连接时间就是树上连接最大值。 $qwq$我居然把路径压缩和按秩合并打到一个程序里了...OvO c++ include using namespace std; const int maxn = 1000010; struct edge { int to;
阅读全文
摘要:Day2:线段树(可持久化),平衡树(splay,treap),并查集,树链剖分,动态树,树状数组,点分治(可持久)。 线段树模板 树链剖分 c++ include include include include using namespace std; struct tree{int l,r,su
阅读全文
摘要:题意:求01成立。 并查集维护,记录一个变量判断决策。 c++ include using namespace std; define int long long const int maxn = 4000010; int f[maxn]; inline int find(int x){ retur
阅读全文

浙公网安备 33010602011771号