![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
线段树
文章平均质量分 85
Cheng Yu
这个作者很懒,什么都没留下…
展开
-
吉司机线段树习题
题目HDU - 5306 Gorgeous SequenceHDU - Art Class HDU - 5306 Gorgeous Sequence 链接:http://acm.hdu.edu.cn/showproblem.php?pid=5306 题意:维护三种操作 0 l r x 对区间 [l,r][l,r][l,r] 取 min(ai,x)min(a_i,x)min(ai,x) 1 l r 查询区间 [l,r][l,r][l,r] 中的最大值 2 l r 查询区间 [l,r][l,r][l,r]原创 2021-05-11 17:37:12 · 306 阅读 · 0 评论 -
线段树习题
Assign the task HDU - 3974(线段树维护DFS序) 链接:http://acm.hdu.edu.cn/showproblem.php?pid=3974 题意:给定一棵树,维护两种操作:C x 表示查询 x 当前的颜色。T x y 表示将包括 x 在内的子树染成颜色 y 。 思路:线段树维护DFS序 #include <cstdio> #include <algorithm> #include <cstring> #define ls (rt<原创 2020-09-13 20:49:31 · 208 阅读 · 0 评论 -
线段树专题
Sum of xor sum ACM-ICPC 2017 Asia Xi’an(线段树维护子区间合并) 题意:给定n个数 a1,a2,…,ana_1,a_2,\dots,a_na1,a2,…,an,给出q个询问求[L,R]内所有子区间的异或和。比如,数组1,2,3中[1,3]的异或和为:1+1xor2+1xor2xor3+2+2xor3+31+1xor2+1xor2xor3+2+2xor3+...原创 2019-11-05 10:34:14 · 114 阅读 · 0 评论 -
线段树
基础知识 1、 线段树是二叉树,且必定是平衡二叉树,但不一定是完全二叉树。 2、 对于区间[ L , R ],令mid=(L+R)/2,则其左子树为[L,mid],右子树为[mid+1,R],当L==R时,该区间为线段树的叶子,无需继续往下划分。 3、 线段树虽然不是完全二叉树,但是可以用完全二叉树的方式去构造并存储它,只是最后一层可能存在某些叶子与叶子之间出现“空叶子”,这个无需理会,同样...原创 2019-08-11 23:24:56 · 416 阅读 · 0 评论