其他分享
首页 > 其他分享> > 左偏树模板

左偏树模板

作者:互联网

#include<iostream>
#include<cstdio>
#include<algorithm>
#include<string>
#include<cmath>
#include<vector>
#include<map>
#include<queue>
#include<deque>
#include<set>
#include<stack>
#include<bitset>
#include<cstring>
#define ll long long
#define max(a,b) ((a>b)?a:b)
#define min(a,b) ((a<b)?a:b)
using namespace std;
const int INF=0x3f3f3f3f,N=100010;

struct left_tree{
    struct node{
        int rc,lc,v,d;
    }t[N];

    int merge(int x,int y){
        if(!x||!y) return x+y;
        if(t[x].v>t[y].v) swap(x,y);
        t[x].rc=merge(t[x].rc,y);
        if(t[t[x].lc].d<t[t[x].rc].d) swap(t[x].lc,t[x].rc);
        t[x].d=t[t[x].rc].d+1;
        return x;
    }
    
    int pop(int x){return merge(t[x].lc,t[x].rc);}
};

int main(){
    
    return 0;
}

标签:lc,左偏,long,rc,include,模板,define
来源: https://www.cnblogs.com/wsyunine/p/14660197.html