线段树、树状数组
yzx930420
这个作者很懒,什么都没留下…
展开
-
poj3468_A Simple Problem with Integers_线段树_成段更新求和
//poj3468 A Simple Problem with Integers//线段树成段更新求和//一开始忘记了数据量大,用的cin,结果一直TLE,ORZ。。。//据说要用什么lazy-tag思想,我也不太清楚这算不算//思路就是每个节点加上一个add,如果某一段从left都到right全部都增加val的话,add加上val,然后就不往下更新了//如果之后算的在这范围之内,求和的原创 2012-06-03 18:05:54 · 295 阅读 · 0 评论 -
hdoj1166_排兵布阵(线段树、树状数组)
//hdoj1166 排兵布阵//做的第一题线段树。。。#include #include #include using namespace std;const int MAXN = 50010;struct Node{ int sum; int left, right;}tree[MAXN * 3];int arr[MAXN];int nN, nCase;void bu原创 2012-06-03 17:51:55 · 419 阅读 · 0 评论 -
hdoj1754_I Hate It_线段树_单点更新求最值
//hdoj1754 I Hate It//线段树,单点更新求最值#include #include #include using namespace std;const int MAXN = 200010;#define L(x) (x) << 1#define R(x) (x) << 1 | 1struct Node{ int left ,right; int max;原创 2012-06-03 18:01:27 · 245 阅读 · 0 评论 -
poj3264_Balanced Lineup_线段树
//poj3264 Balanced Lineup//线段树#include #include #include using namespace std;const int MAXN = 50010;struct MinMax{ int min, max;};struct Node{ struct MinMax minmax; int left, right;}tree原创 2012-06-03 18:02:24 · 211 阅读 · 0 评论