本文共 858 字,大约阅读时间需要 2 分钟。
其实我是不小心翻线性基的时候看见的。
左偏树只会模板,挖坑待补
#include #include #include #include #include #include #include #include #include using namespace std;#define ll long long#define re register#define file(a) freopen(a".in","r",stdin);freopen(a".out","w",stdout)inline int gi(){ int f=1,sum=0;char ch=getchar(); while(ch>'9' || ch<'0'){if(ch=='-')f=-1;ch=getchar();} while(ch>='0' && ch<='9'){sum=(sum<<3)+(sum<<1)+ch-'0';ch=getchar();} return f*sum;}const int N=100010;int f[N],dis[N],ch[N][2],v[N],n,m;int find(int x){ while(f[x])x=f[x]; return x;}int merge(int x,int y){ if(!x || !y)return x+y; if(v[x]>v[y] || (v[x]==v[y] && x>y))swap(x,y); ch[x][1]=merge(ch[x][1],y); f[ch[x][1]]=x; if(dis[ch[x][0]]
转载于:https://www.cnblogs.com/mle-world/p/10266134.html