![](https://img-blog.csdnimg.cn/20201014180756925.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
树状数组/线段树
文章平均质量分 51
大白QQly成长日记
小白自远方来
展开
-
HDU 6315 Naive Operations (Lazy标记线段树)
Problem DescriptionIn a galaxy far, far away, there are two integer sequence a and b of length n.b is a static permutation of 1 to n. Initially a is filled with zeroes.There are two kind of operat...原创 2018-07-27 15:49:24 · 143 阅读 · 0 评论 -
POJ-2155 Matrix(二维树状数组)
DescriptionGiven an N*N matrix A, whose elements are either 0 or 1. A[i, j] means the number in the i-th row and j-th column. Initially we have A[i, j] = 0 (1 <= i, j <= N).We can change the ...原创 2018-11-04 20:41:32 · 255 阅读 · 0 评论 -
POJ-2352 Stars(树状数组应用)
DescriptionAstronomers often examine star maps where stars are represented by points on a plane and each star has Cartesian coordinates. Let the level of a star be an amount of the stars that are no...原创 2018-11-07 12:25:18 · 284 阅读 · 0 评论 -
2018 ICPC徐州网络赛 H.Ryuji doesn't want to study (树状数组)
Ryuji is not a goodstudent, and he doesn't want to study. But there are n books he should learn, each book has its knowledge a[i].Unfortunately, the longer he learns, the fewer he gets.That means,...原创 2018-11-05 17:19:31 · 198 阅读 · 0 评论 -
区间查询小于等于某数
例题:给定一个序列,有多次询问,每次查询区间里小于等于某个数的元素的个数即对于询问 (l,r,x),你需要输出 的值其中 [exp] 是一个函数,它返回 1 当且仅当 exp 成立,其中 exp 表示某个表达式输入描述:第一行两个整数n,m第二行n个整数表示序列a的元素,序列下标从1开始标号,保证1 ≤ ai ≤ 105之后有m行,每行三个整数(l,r,k),保证1 ≤ l...原创 2018-11-18 20:22:07 · 1865 阅读 · 0 评论 -
树状数组实现线段树区间修改区间查询功能
已知树状数组区间修改单点查询时tree数组中存放的是相邻差值,那么区间修改的基础我们已经有了,但只能支持单点查询,需要再构造区间查询功能,暴力累加是不可能考虑的,而树状数组的区间查询是利用前缀和实现的,tree数组中存储的是前缀和。所以我们需要在单点查询的基础上再构造一个前缀和。我们需要整理一下查询第k个数 a[k]=tree[1]+tree[2]+tree[3]+tree[...原创 2018-11-22 19:22:32 · 365 阅读 · 0 评论 -
P2357 守墓人(树状数组/线段树)
题目描述在一个荒凉的墓地上有一个令人尊敬的守墓人, 他看守的墓地从来没有被盗过, 所以人们很放心的把自己的先人的墓安顿在他那守墓人能看好这片墓地是必然而不是偶然.....因为....守墓人懂风水 0.0他把墓地分为主要墓碑和次要墓碑, 主要墓碑只能有 1 个, 守墓人把他记为 1 号, 而次要墓碑有n-1 个,守墓人将之编号为 2,3...n,所以构成了一个...原创 2018-12-01 11:32:17 · 513 阅读 · 0 评论