![](https://img-blog.csdnimg.cn/20201014180756919.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
数据结构 -------- 伸展树
SolarDomo
每天都被头像萌醒
展开
-
HYSBZ 1588 营业额统计 伸展树
题目链接:http://www.lydsy.com/JudgeOnline/problem.php?id=1588 题意:每次查找集合中一个key对于给定的tmp满足 |tmp-key|最小,将tmp加入集合 维护每次的最小差值 第一道伸展树题,大神的模板很好用代码:#include <bits/stdc++.h> #define sf scanf #define pf printf usin原创 2016-09-22 10:41:42 · 361 阅读 · 0 评论 -
HDU 4585 Shaolin Splay 寻找前驱后继
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4585 每次添加一个数在集合中,并寻找这个数在集合排序后的前驱和后继 Splay模板题 每次将节点插入后 查找根左子树最右节点 和 根右子树最左节点代码:#include <bits/stdc++.h> #define sf scanf #define pf printf using namespa原创 2016-09-26 11:02:40 · 514 阅读 · 0 评论 -
伸展树模板
已过的题:HDU 4585/** ---- SPLAY ---- **/ int ch[maxn][2],fa[maxn],size[maxn]; int key[maxn],pos[maxn]; int tot,root,sroot; void Splay_Init(){ tot = 1; root = sroot = 0; ch[0][0] = ch[0][1] = 0;原创 2016-09-26 11:20:03 · 385 阅读 · 0 评论 -
UVA 11922 Permutation Transformer Splay 区间翻转 + 区间合并
题目链接:http://vjudge.net/problem/18902/origin把一个区间翻转后拿出来加到序列的后面代码:#include <bits/stdc++.h> #define sf scanf #define pf printfusing namespace std; const int maxn = 100000 + 50; /** Splay */ int ch[maxn][2原创 2016-10-13 17:12:53 · 352 阅读 · 0 评论