博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
【洛谷3377】 左偏树(可并堆)
阅读量:6988 次
发布时间:2019-06-27

本文共 858 字,大约阅读时间需要 2 分钟。

前言

其实我是不小心翻线性基的时候看见的。

Solution

左偏树只会模板,挖坑待补

代码实现

#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

你可能感兴趣的文章
RocketMQ原理解析-broker 3.load&recover
查看>>
k8s(四)、微服务框架istio安装测试
查看>>
使用Service Mesh整合您的微服务架构
查看>>
阿里开源的 java 诊断工具—— Arthas
查看>>
linux内容批量替换的命令
查看>>
dedecms广告功能分析
查看>>
Confluence 6 升级自定义的站点和空间获得你的自定义布局
查看>>
Angular CLI 创建你的第一个 Angular 示例程序
查看>>
深入理解javascript原型和闭包(16)——完结
查看>>
近日记事2-PG库挂掉了,还是恢复吧~
查看>>
数据源ObjectDataSource的数据访问类的编写
查看>>
如何点击每一列的时候alert其index
查看>>
【原创翻译】类型
查看>>
深入解读Windows Azure VM 实例级 IP
查看>>
python常用函数
查看>>
Eclipse记录
查看>>
C++ 一个自己实现的字符串类
查看>>
KVM
查看>>
Go语言知识积累:windows开发环境搭建
查看>>
我的友情链接
查看>>