
线段树
文章平均质量分 84
devYzhou
Be a man,do the right thing
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
hdu-1166 敌兵布阵
http://acm.hdu.edu.cn/showproblem.php?pid=1166 单点更新 区间求和 睡前一水~ #include #include #include #include #include #include using namespace std; #define MAX 50010 typedef struct { int l;原创 2013-08-20 01:50:42 · 673 阅读 · 0 评论 -
hdu-1556 线段树
http://acm.hdu.edu.cn/showproblem.php?pid=1556 可以说这是线段树的水题了么... 注意输出格式 最后没有空格 #include #include #include #define MAX 100010 using namespace std; typedef struct { int l; int r; int原创 2013-08-19 22:30:22 · 622 阅读 · 0 评论 -
hdu-4691 最长公共前缀-后缀数组
http://acm.hdu.edu.cn/showproblem.php?pid=4691 解析:当然用后缀数组最方便,在后缀数组中有很多重要的定义和性质,现在我们来认识一些: 定义:LCP(i,j)=suffix(SA[i])与suffix[SA[j]]的最长公共前缀长度,即排号序后的后缀中第i名和第j名的最长公共前缀长度。 然后我们再用一个重要的性质就可以求出LCP(i,j)了,性原创 2013-08-20 21:58:02 · 1413 阅读 · 0 评论 -
hdu-1754 I Hate It 线段树
http://acm.hdu.edu.cn/showproblem.php?pid=1754 求区间最大数,并且有单点操作 #include #include #include #include #include #include using namespace std; #define MAX 200010 typedef struct { int l; int原创 2013-08-20 00:03:19 · 683 阅读 · 0 评论 -
poj-3468-A Simple Problem with Integers 线段树lazy标记
http://poj.org/problem?id=3468 有了上一题的基础 这题就是小菜了 #include #include #include #define MAX 100010 using namespace std; typedef struct { long long l; long long r; long long sum; long l原创 2013-08-11 13:49:04 · 663 阅读 · 0 评论 -
hdu-4587-线段树的区间操作- lazy标记
题目来源:http://acm.hdu.edu.cn/showproblem.php?pid=4578 题目大意:给你一个数组,初始值为零 1 x y c 代表 把区间 [x,y] 上的值全部加c 2 x y c 代表 把区间 [x,y] 上的值全部乘以c 3 x y c 代表 把区间 [x,y]上的值全部赋值为c 4 x y p 代表 求区间 [x,y] 上值的p次方和1 线段树原创 2013-08-11 12:38:09 · 1055 阅读 · 0 评论 -
hdu-4614Vases and Flowers 线段树区间赋值
题目来源:http://acm.hdu.edu.cn/showproblem.php?pid=4614 题目是说给你一个区间然后初始值为0就是代表没有花 给你两种操作1 代表从A开始插F只花 花盆为空就查 不为空就往下一个推 直到花插完为止 如果一朵花都能插 就输出Can not put... 如果能就输出第一个插花位置 和最后一个插花位置, 多出来的花扔掉 2 代表把区间A,B原创 2013-08-11 23:00:58 · 900 阅读 · 0 评论 -
poj-2777 线段树lazy标记+位运算
题目来源:http://poj.org/problem?id=2777 题目意思很好懂 就是求解一段区间不同的数字的个数 由于数字的种类小于30 所以可以用位运算来代表不同的种类 纠结了好久开始一直TLE后来才改的位运算 然后用到的就是区间的覆盖问题了 #include #include #include #define MAX 100010 using namespace原创 2013-08-30 23:56:00 · 656 阅读 · 0 评论