平衡树
Mr_Alice
这个作者很懒,什么都没留下…
展开
-
[Splay区间翻转] Luogu p3391 文艺平衡树
题目链接:https://www.luogu.org/problem/P3391 从题解里学到了直接建树,就不需要一个个insert了。 假设我们要翻转区间[L,R],可以先把L-1对应的结点转到根root,R+1对应的结点转到根的右节点right,此时right的左子树就是在[L,R]范围内的结点啦。此时把这个子树每个结点的左右儿子都翻一下,整个区间就翻过来了呢。 然鹅没有必要全部翻过来,...原创 2019-10-23 14:39:03 · 176 阅读 · 0 评论 -
[Splay模板题]POJ3481 num巧用
three kind of operation: op1: insert client whose id is x and priority is p to queue op2: get the client with **highest** priority and drop him from the queue op2: get the client with **lowest**...原创 2019-08-15 20:50:55 · 245 阅读 · 0 评论 -
[Splay模板题]BZOJ1588
很朴素的找前驱和后继,感觉set完全可以做的咳咳。 用来练练splay吧…… #include <bits/stdc++.h> #define lchild(x) (T[x].ch[0]) #define rchild(x) (T[x].ch[1]) #define fa(x) (T[x].fa) using namespace std; typedef long long ll...原创 2019-08-15 21:01:25 · 173 阅读 · 0 评论