码迷,mamicode.com
首页 >  
搜索关键字:rmq 线段树    ( 10188个结果
HDU 4902 (牛叉的线段树)
Nice boatProblem DescriptionThere is an old country and the king fell in love with a devil. The devil always asks the king to do some crazy things. Al...
分类:其他好文   时间:2014-07-31 23:33:50    阅读次数:357
HDU 4902 Nice boat 线段树+离线
据说暴力也过了,还傻逼地写了这么长。。。 #include #include #include #include using namespace std; #define ll long long #define L(x) (x<<1) #define R(x) (x<<1|1) #define Val(x) tree[x].val #define Lazy(x) tree[x].laz...
分类:其他好文   时间:2014-07-31 20:54:47    阅读次数:283
HDU 4902 Nice boat 成段线段树
操作1 的时候标记deng[rt]表示下面一段数都是与当前节点的值相同 下次操作2时直接对有deng标记的节点gcd更新 (可能还可以更简单) #include #include #include #include #include #include #include #include #include #include using namespace std; #def...
分类:其他好文   时间:2014-07-31 20:52:17    阅读次数:250
浅析__线段树延迟标记
浅析__线段树延迟标记...
分类:其他好文   时间:2014-07-31 20:51:24    阅读次数:165
POJ 1195 Mobile phones (二维树状数组)
题目大意: 对一个矩阵上的某个值进行修改,然后求出子矩阵的和。 思路分析: 这题discuss 上说二维线段树过不了。 所以二维树状数组搞。 理解树状数组的意义就是 1 - n 上所有的和。 然后两重循环。 #include #include #include #include #define maxn 1040 #define lowbit(x) (x&(-...
分类:其他好文   时间:2014-07-31 20:46:37    阅读次数:201
POJ 3321 Apple Tree (dfs+线段树)
题目大意: 修改树上的节点,然后求子树的和。 思路分析: dfs 重新编号,烂大街了。。。 #include #include #include #include #define maxn 100005 #define lson num<<1,s,mid #define rson num<<1|1,mid+1,e using namespace std; int num[...
分类:移动开发   时间:2014-07-31 20:46:27    阅读次数:251
HDU 1166
线段树 1 #include 2 #include 3 using namespace std; 4 #define N 200010 5 int sum[N]; 6 void build(int l,int r,int root){ 7 if(l==r)scanf("%d",&sum...
分类:其他好文   时间:2014-07-31 16:21:47    阅读次数:200
HDU 1698
线段树,懒惰标记 1 #include 2 #include 3 using namespace std; 4 #define N 400010 5 int sum[N],lazy[N]; 6 void pushup(int root){ 7 sum[root]=sum[root*2]+...
分类:其他好文   时间:2014-07-31 16:07:46    阅读次数:255
HDU - 1394 Minimum Inversion Number (线段树求逆序数)
Description The inversion number of a given number sequence a1, a2, ..., an is the number of pairs (ai, aj) that satisfy i aj. For a given sequence of numbers a1, a2, ..., an, if we move the ...
分类:其他好文   时间:2014-07-31 13:31:46    阅读次数:229
POJ--2528--Mayor's posters【线段树+离散化】
题意:在一块木板上贴海报,每次贴海报给一个横坐标范围,在这个范围内贴,按照它给的顺序,海报可以被覆盖,问最后还能看见几张海报。 都说这是线段树入门题。。。。结果我还是出翔了,不是在线段树部分,是在离散化部分。 我之前看到一个很飘逸的离散化写法,可惜找不到了,这回是这么写的:去重之后再把每个点的后一个值也加入离散化后的数组(如果这个值之前没有的话),这样避免了漏掉中间没被覆盖的情况。 ...
分类:其他好文   时间:2014-07-31 13:30:06    阅读次数:164
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!