POJ 3468 A Simple Problem with Integers (Splay)
紫杉
Splay
2016-09-25
2,409
题目链接:点我~~
题意:给n个数,有两种操作,一种是查询区间和,另一种是在区间上每一个数加上v。
思路:第一次摸splay tree,这题算是个模板题,适合思考人生。。。
//Splay(x,0); 将x变为跟节点
//Splay(x,root); 将x变为root下的节点 维护区间时通常旋转为root的右子树
//所需要维护的区间[l,r],通过旋转后...