随笔分类 - 线段树
摘要: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...
阅读全文
摘要:E. Lucky ArrayPetya loves lucky numbers. Everybody knows that lucky numbers are positive integers whose decimal representation contains only the lucky...
阅读全文
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=3308题意: 两个操作 : 1 修改 单点 a 处的值。 2求出 区间【a,b】内的最长上升子序列。做法:线段树区间合并。了解线段树的具体含义很容易。1//bycaonima2//hehe3#include4#...
阅读全文
摘要:http://poj.org/problem?id=3667题意:两个操作 : 1 选出靠左的长度为a的区间。 2 把从 a到a+b的区间清空。线段树区间合并+lazy//bycaonima//hehe#include#include#include#include#includeusingname...
阅读全文
摘要: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...
阅读全文
摘要: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...
阅读全文
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=4893先贴上一份还没过的代码,不知道拿出错了1//bycaonima2//hehe3#include4#include5#include6#include7#include8#include9#include10#...
阅读全文
摘要:D. The Child and Sequencetime limit per test4 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputAt the children's day, ...
阅读全文
摘要:http://codeforces.com/contest/444/problem/C题意:给出一个数组,初始时每个值从1--n分别是1--n. 然后两种操作。1:操作 a.b内的数字是a,b内的数字变成v,然后得到的变化值记为dx.2:询问 a,b内的变化值得大小。sl:做法是懂了,但是这么做为什...
阅读全文
摘要:题意:支持增删,查操作,最后的序列式递增的。做法:主要是如何维护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,
阅读全文

浙公网安备 33010602011771号