摘要: 1 #include 2 #include 3 #include 4 #include 5 #include 6 #include 7 8 #include 9 #include 10 #include 11 #include 12 #include 13 #include 14 #include 15 16 using namespace std; 17 18 inli... 阅读全文
posted @ 2017-08-27 21:10 Running-Coder 阅读(178) 评论(0) 推荐(0) 编辑
摘要: PS:某大佬讲,当心情特别好or特别不好的时候,可以来攻略这个题。。。果然萌新足足被这题恶心了半个月。。。 进入正题: 这道题题意如此之裸-Splayの究极进化,那么就没有什么好讲的,直接说搞法好了。。。 为了代码写起来方便,萌新封装得可能有些过,若不合诸位大佬的口味还请见谅~ 节点node结构体定 阅读全文
posted @ 2017-08-12 22:40 Running-Coder 阅读(243) 评论(0) 推荐(0) 编辑
摘要: 指针大法好 无父指针Splay大法好 大佬们的“改变旋转方向”萌新表示不懂,于是就自己乱搞出了下面的搞法。。。 代码如下,萌新写的丑,诸位大佬见谅QwQ~ 阅读全文
posted @ 2017-07-22 17:58 Running-Coder 阅读(222) 评论(0) 推荐(0) 编辑
摘要: 结构体node定义:呐...因为不是Treap,所以就不必定义优先级yx了; 这次为了代码简短,总算是把判断子树方向函数(cmp)和节点信息维护函数(maintain)封在了结构体里。 旋转函数rotate:与Treap相比,没有任何变化,就是写得简短了一些。 插入函数insert:Treap时需要 阅读全文
posted @ 2017-07-20 22:59 Running-Coder 阅读(502) 评论(0) 推荐(0) 编辑
摘要: 输入格式: 1.输入两个整数n,m,表示矩阵的长和宽; 2.输入n行m列个整数,为矩阵的每个元素; 3.输入一个整数T,表示操作次数; 4.输入T行: 格式1:1 x y k,表示将坐标为(x,y)的点加上k; 格式2:2 x1 y1 x2 y2,表示求左上角坐标为(x1,y1),右下角坐标为(x2 阅读全文
posted @ 2017-07-18 17:44 Running-Coder 阅读(186) 评论(0) 推荐(0) 编辑
摘要: 1 #include 2 #include 3 #include 4 #include 5 #include 6 #include 7 8 #include 9 #include 10 #include 11 #include 12 #include 13 14 using namespace std; 15 16 void add(int,int); 17 int pr... 阅读全文
posted @ 2017-06-22 22:29 Running-Coder 阅读(130) 评论(0) 推荐(0) 编辑
摘要: 1 #include 2 #include 3 #include 4 #include 5 #include 6 #include 7 #include 8 #include 9 #include 10 #include 11 #include 12 #include 13 using namespace std; 14 struct node{ ... 阅读全文
posted @ 2017-06-21 22:47 Running-Coder 阅读(231) 评论(0) 推荐(0) 编辑
摘要: 链接: http://pan.baidu.com/s/1qYGz4Ck 密码:xnwc 阅读全文
posted @ 2017-06-10 12:38 Running-Coder 阅读(242) 评论(0) 推荐(0) 编辑
摘要: 此题相对于模板一,加了个区间乘,于是在模板一的基础上需要多开个数组(记录乘法懒标记)、多写个函数(区间乘),还有要把懒标记下放函数做些修改。 变量定义: sum[]:线段树节点对应区间的元素总和; addv[]:线段树节点对应区间的所有元素待加的值(懒标记),初值全部设为0; mulv[]:线段树节 阅读全文
posted @ 2017-05-24 22:58 Running-Coder 阅读(180) 评论(0) 推荐(0) 编辑
摘要: 变量定义: sum[]:线段树节点对应区间的元素总和; addv[]:线段树节点对应区间的所有元素的待追加值(懒标记),初值全部设为0。 过程说明: 建树(Build): 若当前节点仅包含原序列中的一个值,即L=R,则直接赋值为序列中该值,否则递归建立左右子树后,将左右子树保存的sum值相加,即得到 阅读全文
posted @ 2017-05-24 22:53 Running-Coder 阅读(193) 评论(0) 推荐(0) 编辑