
线段树
deprecated_tzg
这个作者很懒,什么都没留下…
展开
-
hdu 4578 Transformation
http://acm.hdu.edu.cn/showproblem.php?pid=4578 算是裸的线段树,不难推出来把所有过程看成 x * a + b ,a、b的值随情况而定。。。一开始把3种下推更新放在同一个公式更新里,果断超时;实践证明,这题就是考察线段树的划分时候的细节问题;把很多状态手写,总算过了 #include using namespace std; #ifdef原创 2013-11-04 01:15:22 · 561 阅读 · 0 评论 -
线段树合集 II
hdu 4553 约会安排 段更新里稍微复杂的应用,需要设置多个判断标志,反正当时比赛的时候没做出来,还是挺烦人的原创 2013-11-20 19:39:15 · 1011 阅读 · 0 评论 -
线段树合集 I
基于个人对线段树的理解,线段树的核心思想就在于离散化和滞后性 http://acm.hdu.edu.cn/showproblem.php?pid=1542 将线段离散化,自己一开始利用线段树将沿y坐标的矩阵归并可惜总是wa,最后借鉴了别人的方法 #include #include using namespace std; const int MAXN = 5000;原创 2013-11-09 10:22:20 · 943 阅读 · 0 评论 -
线段树合集 III
hdu 4747 Mex 这道题明显考的是思维方式,线段树作为成段更新求和的辅助。 #include #include #include #include using namespace std; /* http://acm.hdu.edu.cn/showproblem.php?pid=4747 */ const int MAXN = 200010; const int I原创 2013-12-01 23:14:20 · 753 阅读 · 0 评论 -
hdu 3966 Aragorn's Story(树连剖分)
树连剖分,线段树 树链剖分的核心就是将树线性化,从而简化对其的操作 #include #include #include #include using namespace std; typedef long long ll; const int MAXN = 50010; #ifndef __GNUC__ #pragma comment(linker, "/STACK:1024原创 2013-09-24 18:49:47 · 544 阅读 · 0 评论 -
hdu 5091 Beam Cannon(线段树)
hdu 5091 Beam Cannon 实际上题目约等于在一条横坐标轴下有一系列的点,求用一个定长(L)的线段能覆盖的最大点数,且点可动态增减。 对于可能覆盖的每个点x,线段的中心位置可以用一个区间表示[x-L/2,x+L/2]。那么最终结果就等于某一范围被重叠的最多次次数。由此再推广到二维坐标系 #include #include #include #include原创 2014-11-25 20:56:23 · 645 阅读 · 0 评论 -
hdu 5111 Alexandra and Two Trees(树链剖分+函数式线段树)
#include #include #include #include #include #include #include using namespace std; #define MID ( (l+r)>>1 ) const int MAXN = 100005; map mp; int itp[MAXN]; struct _edge { int v, next; _edge(i转载 2015-01-28 00:41:54 · 640 阅读 · 0 评论