Splay-Tree
丿残念灬
这个作者很懒,什么都没留下…
展开
-
HDU-4453 Looploop(Splay树)
传送门:HDU-4453题解:Splay树如果要把指针从1移到2,可以把1先删除,再插入到n的后面,如果要把指针从1移动到n,可以把n删除,再插入到1的前面#includeusing namespace std;const int MX = 2e5 + 5;int m, k1, k2;int n;int a[MX];int root, rear; //根节点原创 2017-07-29 21:51:30 · 405 阅读 · 0 评论 -
POJ-3580 SuperMemo(Splay树)
SuperMemoTime Limit: 5000MS Memory Limit: 65536KTotal Submissions: 16260 Accepted: 5111Case Time Limit: 2000MSDescriptionYour friend, Jackson is invited to原创 2017-07-30 00:00:54 · 336 阅读 · 0 评论 -
ZOJ-3765 Lights(Splay树)
LightsTime Limit: 8 Seconds Memory Limit: 131072 KB Now you have N lights in a line. Don't worry - the lights don't have color. The only status they have is on and off. And, each ligh原创 2017-07-24 21:02:06 · 279 阅读 · 0 评论 -
Splay树
作者:Dong | 新浪微博:西成懂 | 可以转载, 但必须以超链接形式标明文章原始出处和作者信息及版权声明网址:http://dongxicheng.org/structure/splay-tree/1、 概述二叉查找树(Binary Search Tree,也叫二叉排序树,即Binary Sort Tree)能够支持多种动态集合操作,它可以用来表示有序集合、建立转载 2017-07-24 21:05:10 · 296 阅读 · 0 评论 -
Splay树模板
#include#define root_right ch[root][1]using namespace std;const int MX = 4e5 + 5;int a[MX], S[MX], n;int root, rear; //根节点,节点总数int rem[MX], tot; //经过删除后未被使用的节点int ch[MX][2], fa[M原创 2017-07-24 21:06:26 · 228 阅读 · 0 评论 -
HDU-3436 Queue-jumpers(Splay树)
传送门:HDU-3436由于询问只有1e5次,但n(吐槽:用通常的splay做法超时了,又换了种写法结果就快了几倍。。。#include#define lson l,m,rt<<1#define rson m+1,r,rt<<1|1#define first x#define second y#define eps 1e-8using namespace std;ty原创 2017-08-02 23:31:10 · 280 阅读 · 0 评论