摘要: 一道区间更新、查询的题;但是线段树不能做插入;后来才知道用splay;splay用来做区间查询的话,先将l-1旋转到根节点,然后把r+1旋转到根节点的右节点;这样的话,根节点的右节点的左子树就是我们要的区间;我的代码是网上大神的代码改了一下过来的,存着做模板;#include#include#include#define maxn 2000009#define lch(rt) son[rt][0]#define rch(rt) son[rt][1]using namespace std;int son[maxn][2],fa[maxn],size[maxn],val[maxn],st[maxn 阅读全文
posted @ 2014-03-04 13:42 Yours1103 阅读(187) 评论(0) 推荐(0) 编辑