SuperMemo         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 pe…
相应POJ题目:点击打开链接 SuperMemo Time Limit: 5000MS   Memory Limit: 65536K Total Submissions: 11309   Accepted: 3545 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…
题目连接 http://poj.org/problem?id=3580 SuperMemo 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, A…
题目链接:http://poj.org/problem?id=3580 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 h…
SuperMemo Time Limit: 5000MS   Memory Limit: 65536K Total Submissions: 6841   Accepted: 2268 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.…
题意: 维护一个序列,支持如下几种操作: ADD x y D:将区间\([x,y]\)的数加上\(D\) REVERSE x y:翻转区间\([x,y]\) REVOLVE x y T:将区间\([x,y]\)向右循环平移\(T\)个长度 INSERT x P:在第\(x\)个元素后插入\(P\) DELETE x:删除第\(x\)个元素 QUERY x y:查询区间\([x,y]\)中的最小值 分析: ADD和REVERSE操作维护两个懒惰标记即可 REVOLVE操作本质还是CUT一段区间下来…
前几天刚刚自学了一下splay,发现思路真简单实现起来好麻烦 先贴一下头文件 # include <stdio.h> # include <stdlib.h> # include <iostream> # include <string.h> # define ll long long # define RG register//卡常 # define IL inline//再卡常 # define UN unsigned # define mem(a, b…
题目传送门 题意:四种集合的操作,对应区间的01,问最后存在集合存在的区间. 分析:U T [l, r]填充1; I T [0, l), (r, N]填充0; D T [l, r]填充0; C T[0, l), (r, N]填充0并且[l, r]xor; S T [l, r]xor 线段树结点两个属性,cover[o]: 该区间是否填充(1, 0, -1),_xor[o]: 该区间是否异或反转(1, 0).最后(和[的区别可以原数*2判奇偶得 #include <cstdio> #includ…
题意:让你维护一个序列,支持以下6种操作: ADD x y d: 第x个数到第y个数加d . REVERSE x y : 将区间[x,y]中的数翻转 . REVOLVE x y t :将区间[x,y]循环移位t次,如1 2 3 4 5 旋转2次后就变成4 5 1 2 3 . INSERT x p :在第x个数后面插入p . DELETE x :删除第x个数 . MIN x y : 查询区间[x,y]中的最小值 .思路:此题有反转区间和循环移位的操作,所以我们很容易可以想到用 splay FHQ_…
伸展树(splay树),是二叉排序树的一种.[两个月之前写过,今天突然想写个博客...] 伸展树和一般的二叉排序树不同的是,在每次执行完插入.查询.删除等操作后,都会自动平衡这棵树.(说是自动,也就是多了一段代码,把这个节点提到根节点的位置上罢了) 伸展树的调整是基于两种旋转操作的[左旋右旋嘛]. 分别是这样的(对2号节点操作): (有点草率啊这个图) 对于这两个操作,只需要处理好指针为空的情况即可(我的splay树包含了father指针,可能比另一种写法更繁琐一些) void lec(nod…