
线段树
文章平均质量分 72
皮得一1
这个作者很懒,什么都没留下…
展开
-
poj 2528 Mayor's posters(线段树离散化)
题意:n(n 求出最后还能看见多少张海报。 思路:离散化,如下面的例子(题目的样例),因为单位1是一个单位长度,将下面的 1 2 3 4 6 7 8 10 — — — — — — — — 1 2 3 4 5 6 7 8 离散化 X[1] = 1; X原创 2016-02-03 22:49:12 · 288 阅读 · 0 评论 -
hdu 1698 Just a Hook(线段树区间覆盖)
#include #include using namespace std; #define lson l , m , rt << 1 #define rson m + 1 , r , rt << 1 | 1 const int maxn = 111111; int h , w , n; int col[maxn<<2]; int sum[maxn<<2]; void PushUp(int原创 2016-02-03 18:16:01 · 282 阅读 · 0 评论 -
hdu 1754 I Hate It(线段树求最大值)
#include #include using namespace std; #define lson l , m , rt << 1 #define rson m + 1 , r , rt << 1 | 1 const int maxn = 222222; int MAX[maxn<<2]; void PushUP(int rt) { MAX[rt] = max(MAX[rt<<1]原创 2016-02-03 17:26:34 · 347 阅读 · 0 评论 -
hdu 1255 覆盖的面积(线段树离散化)
参考资料:http://blog.youkuaiyun.com/sunmenggmail/article/details/7984589 #include #include #include using namespace std; const int maxn=1100; struct LINE { double x, y_down, y_up; int flag;原创 2015-11-14 22:22:10 · 461 阅读 · 0 评论 -
zoj 1601 Count the Colorst(线段树)
题意:有一段长为8000的区间,在区间内涂色,(a,b,c)代表在区间[a,b]内涂色c,最后统计每种颜色的区间个数。 #include #include #include #include using namespace std; const int MAXN=8010; struct Node { int l,r; int color; }segTree[MAXN原创 2015-11-09 12:32:25 · 404 阅读 · 0 评论 -
poj 3468 A Simple Problem with Integers(线段树更新区间)
线段树:http://blog.youkuaiyun.com/metalseed/article/details/8039326 #include #include using namespace std; #define maxn 111111 long long add[maxn*4]; long long sum[maxn*4]; void PushUp(int rt) { su原创 2015-11-08 19:06:16 · 311 阅读 · 0 评论 -
hdu 1166 敌兵布阵(线段树单点更新)
线段树:http://blog.youkuaiyun.com/metalseed/article/details/8039326 题目大意:单点更新线段树,求区间和。 #include #define N 50005 int sum[N*4]; void Build(int l,int r,int rt) { if(l==r) { scanf("%d",&su原创 2015-11-08 17:50:17 · 432 阅读 · 0 评论