poj3580】的更多相关文章

SuperMemo Time Limit: 5000MS   Memory Limit: 65536K Total Submissions: 12795   Accepted: 3989 Case Time Limit: 2000MS Description Your friend, Jackson is invited to a TV show called SuperMemo in which the participant is told to play a memorizing game…
好题.我做了很久,学了大牛们的区间搬移.主要的代码都有注释. #include<cstdio> #include<cstring> #include<iostream> #include<algorithm> #define INF 999999999 #define key_value ch[ch[root][1]][0] using namespace std; ; ],s[MAXN],key[MAXN],tot1,tot2,root,ans[MAXN]…
区间操作的究极题,我们一个个来分析其实只有insert,delete,revolve三种没讲过insert 先把x旋到根,一开始我比较SB的,准备把新节点插入到右子树的最左节点,这显然很烦 好的方法是,直接在根和右孩子之间插入即可,相当于right[new]=right[root] right[root]=new 然后维护一下new和root即可即可delete 我一开始使用的是杨思雨大神splay论文中的方法,但是好像很烦 后来发现,一个比较简洁的做法,先把x的后继旋到根,然后把x旋到根的儿子…
Description Your friend, Jackson is invited to a TV show called SuperMemo in which the participant is told to play a memorizing game. At first, the host tells the participant a sequence of numbers, {A1, A2, ... An}. Then the host performs a series of…
Description Your friend, Jackson is invited to a TV show called SuperMemo in which the participant is told to play a memorizing game. At first, the host tells the participant a sequence of numbers, {A1, A2, ... An}. Then the host performs a series of…
题意:实现一种数据结构,支持对一个数列的 6 种操作:第 x 个数到第 y 个数之间的数每个加 D:第 x 个数到第 y 个数之间全部数翻转:第 x 个数到第 y 个数之间的数,向后循环流动 c 次,即后面 c个数变成这段子序列的最前面 c 个,前面的被挤到后面.在第 x 个数后面插入一个数 P.删除第 x 个数.求第 x 个数到第 y 个数之间的最小数字. 题解: (待补) 代码先放上: (是真的长啊,我已经是比较压行的选手了,依然写了230行) 1.利用stack回收内存池 #include…
Your friend, Jackson is invited to a TV show called SuperMemo in which the participant is told to play a memorizing game. At first, the host tells the participant a sequence of numbers, {A1, A2, ... An}. Then the host performs a series of operations…
题面 题解 对于操作$1$,我们可以对于每个节点打一个$add$标记,下放就行了 对于操作2,可以参考这篇题解的上一篇,不赘述 对于操作4,可以将区间裂成两部分,然后再插入合并 对于操作5,可以将区间裂成三部分,删除其中一个部分,合并其他两部分 对于操作6,打一个$min$标记,具体可以看代码. 对于操作3,这个有点复杂,但是手玩可以发现,修改完后只是某两个断开的区间换了位置,只是断点不确定,算一下即可(细节有点多.) #include <ctime> #include <cstdio&…
fhqtreap的写法 操作其实都差不多哇 #include<cstdio> #include<cstring> #include<algorithm> using namespace std; ; int read(){ ,f=,c=getchar(); ; c=getchar();} +(c-'); c=getchar();} return ans*f; } int n,m,sum; struct node{ node *l,*r; int sz,v,rnd,rev…
浅谈\(splay\):https://www.cnblogs.com/AKMer/p/9979592.html 浅谈\(fhq\)_\(treap\):https://www.cnblogs.com/AKMer/p/9981274.html 题目传送门:http://poj.org/problem?id=3580 对于\(REVOLVE\)操作,就相当于把\([r-t+1,r]\)剪切下来粘贴到\([l-1,l]\)中间,其余的操作都是平衡树较为模板的操作了.记得把零号点的最小值赋成\(inf…