
线段树
文章平均质量分 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 50010typedef struct{ int l;原创 2013-08-20 01:50:42 · 664 阅读 · 0 评论 -
hdu-1556 线段树
http://acm.hdu.edu.cn/showproblem.php?pid=1556可以说这是线段树的水题了么...注意输出格式 最后没有空格#include #include #include #define MAX 100010using namespace std;typedef struct{ int l; int r; int原创 2013-08-19 22:30:22 · 611 阅读 · 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 · 1397 阅读 · 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 200010typedef struct{ int l; int原创 2013-08-20 00:03:19 · 674 阅读 · 0 评论 -
poj-3468-A Simple Problem with Integers 线段树lazy标记
http://poj.org/problem?id=3468有了上一题的基础 这题就是小菜了#include #include #include #define MAX 100010using namespace std;typedef struct{ long long l; long long r; long long sum; long l原创 2013-08-11 13:49:04 · 649 阅读 · 0 评论 -
hdu-4587-线段树的区间操作- lazy标记
题目来源:http://acm.hdu.edu.cn/showproblem.php?pid=4578题目大意:给你一个数组,初始值为零1 x y c 代表 把区间 [x,y] 上的值全部加c2 x y c 代表 把区间 [x,y] 上的值全部乘以c3 x y c 代表 把区间 [x,y]上的值全部赋值为c4 x y p 代表 求区间 [x,y] 上值的p次方和1线段树原创 2013-08-11 12:38:09 · 1044 阅读 · 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 · 878 阅读 · 0 评论 -
poj-2777 线段树lazy标记+位运算
题目来源:http://poj.org/problem?id=2777题目意思很好懂 就是求解一段区间不同的数字的个数由于数字的种类小于30所以可以用位运算来代表不同的种类 纠结了好久开始一直TLE后来才改的位运算然后用到的就是区间的覆盖问题了#include #include #include #define MAX 100010using namespace原创 2013-08-30 23:56:00 · 646 阅读 · 0 评论