摘要: #include<iostream> #include<cstdio> using namespace std; const int Maxn=10000000; int tr[2*Maxn+10]; int lowbit(int x) { return x&(-x); } void add(int 阅读全文
posted @ 2022-03-17 23:17 心悟&&星际 阅读(42) 评论(0) 推荐(0)
摘要: #include<bits/stdc++.h> #define INF INT_MAX using namespace std; const int maxn=100010; int sum=0,R=0; int sz[maxn],v[maxn],num[maxn],rd[maxn],son[max 阅读全文
posted @ 2022-03-17 23:14 心悟&&星际 阅读(26) 评论(0) 推荐(0)
摘要: #include<bits/stdc++.h> using namespace std; const int N=10000010; int T[N<<3]; void update(int p,int v,int rt,int l,int r) { T[rt]+=v; if (l==r) retu 阅读全文
posted @ 2022-03-17 23:09 心悟&&星际 阅读(41) 评论(0) 推荐(0)
摘要: 替罪羊树——简单粗暴的数据结构正题如果在一棵平衡的二叉搜索树内进行查询等操作,时间就可以稳定在log(n),但是每一次的插入节点和删除节点,都可能会使得这棵树不平衡,最坏情况就是退化成一条链,显然我们不想要这种树,于是各种维护的方法出现了,大部分的平衡树都是通过旋转来维护平衡的,但替罪羊树就很厉害了 阅读全文
posted @ 2022-03-17 23:02 心悟&&星际 阅读(57) 评论(0) 推荐(0)