![](https://img-blog.csdnimg.cn/20201014180756925.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
树状数组
文章平均质量分 79
KirinSB
这个作者很懒,什么都没留下…
展开
-
POJ 2155 Matrix (二维树状数组)题解
思路:没想到二维树状数组和一维的比只差了一行,update单点更新,query求和这里的函数用法和平时不一样,query直接算出来就是某点的值,怎么做到的呢?我们在更新的时候不止更新一个点,而是四个点,这样就会变成下图这样的效果看不懂听我讲一下...这和上次嘉诚讲过的差分数组有点像(自觉回顾讲过什么),既然单点更新更新完是(1,1)~(x,y)的和在改变,那么我们只要在区间后面减去增加的,那么我们...原创 2018-07-09 18:07:41 · 510 阅读 · 0 评论 -
hdu 3874(树状数组)题解
Problem DescriptionMery has a beautiful necklace. The necklace is made up of N magic balls. Each ball has a beautiful value. The balls with the same beautiful value look the same, so if two or more ba...原创 2018-04-28 12:28:46 · 208 阅读 · 0 评论 -
poj 2481 Cows(树状数组)题解
DescriptionFarmer John's cows have discovered that the clover growing along the ridge of the hill (which we can think of as a one-dimensional number line) in his field is particularly good. Farmer Joh...原创 2018-04-30 21:03:32 · 428 阅读 · 0 评论 -
POJ 2352 Stars(树状数组)题解
Language:DefaultStarsTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 52268Accepted: 22486DescriptionAstronomers often examine star maps where stars are represented by points on a plane and ea...原创 2018-05-07 20:28:43 · 214 阅读 · 0 评论 -
POJ 2029 (二维树状数组)题解
思路:大力出奇迹,先用二维树状数组存,然后暴力枚举算某个矩形区域的值的示意图如下,代码在下面慢慢找...代码:#include<cstdio>#include<map>#include<cstring>#include<algorithm>#define ll long longusing namespace std;const int ...原创 2018-07-10 20:01:55 · 196 阅读 · 0 评论