随笔分类 -  线段树

摘要:Problem 2105 Digits CountProblem DescriptionGiven N integers A={A[0],A[1],...,A[N-1]}. Here we have some operations:Operation 1:AND opn L RHere opn, L... 阅读全文
posted @ 2014-08-07 19:50 acvc 阅读(192) 评论(0) 推荐(0)
摘要:E. Lucky ArrayPetya loves lucky numbers. Everybody knows that lucky numbers are positive integers whose decimal representation contains only the lucky... 阅读全文
posted @ 2014-08-02 22:10 acvc 阅读(383) 评论(0) 推荐(0)
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=3308题意: 两个操作 : 1 修改 单点 a 处的值。 2求出 区间【a,b】内的最长上升子序列。做法:线段树区间合并。了解线段树的具体含义很容易。1//bycaonima2//hehe3#include4#... 阅读全文
posted @ 2014-08-01 18:47 acvc 阅读(177) 评论(0) 推荐(0)
摘要:http://poj.org/problem?id=3667题意:两个操作 : 1 选出靠左的长度为a的区间。 2 把从 a到a+b的区间清空。线段树区间合并+lazy//bycaonima//hehe#include#include#include#include#includeusingname... 阅读全文
posted @ 2014-08-01 18:45 acvc 阅读(200) 评论(0) 推荐(0)
摘要:lazy区间修改 :http://acm.hdu.edu.cn/showproblem.php?pid=4902 (hdu4902)http://acm.hdu.edu.cn/showproblem.php?pid=4893 (hdu4902)http://codeforces.com/conte... 阅读全文
posted @ 2014-08-01 14:57 acvc 阅读(396) 评论(0) 推荐(0)
摘要: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... 阅读全文
posted @ 2014-07-31 21:03 acvc 阅读(810) 评论(0) 推荐(0)
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=4893先贴上一份还没过的代码,不知道拿出错了1//bycaonima2//hehe3#include4#include5#include6#include7#include8#include9#include10#... 阅读全文
posted @ 2014-07-29 20:12 acvc 阅读(194) 评论(0) 推荐(0)
摘要:D. The Child and Sequencetime limit per test4 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputAt the children's day, ... 阅读全文
posted @ 2014-07-08 23:37 acvc 阅读(240) 评论(0) 推荐(0)
摘要:http://codeforces.com/contest/444/problem/C题意:给出一个数组,初始时每个值从1--n分别是1--n. 然后两种操作。1:操作 a.b内的数字是a,b内的数字变成v,然后得到的变化值记为dx.2:询问 a,b内的变化值得大小。sl:做法是懂了,但是这么做为什... 阅读全文
posted @ 2014-07-08 00:00 acvc 阅读(173) 评论(0) 推荐(0)
摘要:题意:支持增删,查操作,最后的序列式递增的。做法:主要是如何维护mod5的sum值,这里左儿子可以不用管,关键是右儿子的处理,可以假设右儿子有t个节点,左儿子有cnt个节点,则令(t+cnt)MOD 5= i 则tmod5=(i-cnt MOD 5)MOD 5 ,所以剩下的就是维护每个节点的节点总数以及相应的和就好了。1#include2#include3#include4typedeflonglongll;5usingnamespacestd;6#definelzu>1;21build(lz);build(rz);22}23}24voidadd(intu,intl,intr,intx, 阅读全文
posted @ 2014-02-02 22:37 acvc 阅读(405) 评论(1) 推荐(0)