![](https://img-blog.csdnimg.cn/20201014180756754.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
树状数组
文章平均质量分 72
tyg_zx
这个作者很懒,什么都没留下…
展开
-
POJ3928
#include #include #include #include using namespace std; const int maxn=100005; const int maxm=20005; int c[maxn]; int rank1[maxm]; int d[maxn]; int left1[maxm]; int right1[maxm]; int n; int lowbi原创 2014-10-30 23:11:50 · 672 阅读 · 0 评论 -
数组数组求第K小数
//还真没想到过树状数组还有这个功能。。。。。。。。。 //原来作者地址。。ORZ http://www.cnblogs.com/zgmf_x20a/archive/2008/11/15/1334109.html 回顾树状数组的定义,注意到有如下两条性质: 一,c[ans]=sum of A[ans-lowbit(ans)+1 ... ans]; 二,当ans=2^k时, c[转载 2015-07-30 04:07:11 · 1123 阅读 · 0 评论 -
HDU2852
//看到这道题的第一想法是treap....个人感觉treap应该也是可行了。网上流传的树状数组的方法也是二分暴力。。。 #include #include #include #include #include using namespace std; const int maxn=100000+1; int sum[maxn]; int lowbit(int x) { return原创 2015-07-30 05:15:37 · 518 阅读 · 0 评论