码迷,mamicode.com
首页 >  
搜索关键字:树状数组    ( 3763个结果
【BZOJ】1012: [JSOI2008]最大数maxnumber(树状数组+区间最值)
http://www.lydsy.com/JudgeOnline/problem.php?id=1012树状数组原来我只懂得sum和add的操作,今天才知道可以有求区间最值的操作,我学习了一下写了个,1a了。区间最值其实和区间求和差不多,就是将sum数组的含义转移到max,然后通过特定的区间更新ma...
分类:Web程序   时间:2014-07-26 14:37:50    阅读次数:251
poj2155--Matrix(二维树状数组)
二维树状数组 poj2155...
分类:其他好文   时间:2014-07-26 02:08:16    阅读次数:241
POJ1990 MooFest 树状数组(Binary Indexed Tree,BIT)
N头牛排成一列,每头牛的听力是Vi,每头牛的位置Pi,任意两头牛i,j相互交流时两头牛都至少需要发出声音的大小为max(Vi,Vj) * |Pi-Pj|,求这N头牛两两交流总共发出的声音大小是多少。N,V,P都是1-20000的范围。         这题首先对Vi从小到大进行排序,排序过后就可以依次计算i,将所有比Vi小的牛到i之间的距离之和乘以Vi得到Ri,然后累加Ri就是最终结果...
分类:其他好文   时间:2014-07-25 11:27:51    阅读次数:193
Dynamic Inversions II 逆序数的性质 树状数组求逆序数
Dynamic Inversions IITime Limit:6000/3000MS (Java/Others)Memory Limit:128000/64000KB (Java/Others)SubmitStatusProblem Description给出N个数a[1],a[2] ... a[...
分类:其他好文   时间:2014-07-25 02:44:34    阅读次数:168
hdu 4217Data Structure?
树状数组+二分 就是找第几小的数,,找几次,再求和。。 #include #include #include #include #include using namespace std; const int N=277777; int t,n,m,bit[N],num,i; long long ans; int low(int g) { return g&(-g); } void up...
分类:其他好文   时间:2014-07-24 23:29:33    阅读次数:266
BNUOJ-22868-Movie collection(树状数组)
DescriptionMr. K. I. has a very big movie collection. He has organized his collection in a big stack. Whenever he wants to watch one of the movies, he...
分类:其他好文   时间:2014-07-24 21:58:12    阅读次数:394
poj-3067 Japan(树状数组)
DescriptionJapan plans to welcome the ACM ICPC World Finals and a lot of roads must be built for the venue. Japan is tall island with N cities on the ...
分类:其他好文   时间:2014-07-24 21:43:52    阅读次数:270
poj 2352 Stars 树状数组
树状数组,果断1A啦,心情舒畅啊,哈哈 先按照y轴从小到大排序,然后一次加入并统计每个点得x坐标,这道题数据不严谨啊,在y轴相同得情况下,应该以x轴从大到小排序,可我都没排x轴就过了 #include #include #include #include using namespace std; int Max; struct node{ int x,y; }a[15005]; int...
分类:其他好文   时间:2014-07-24 10:23:24    阅读次数:185
hdu 2838 Cow Sorting(树状数组)
Cow Sorting Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 2239    Accepted Submission(s): 711 Problem Description Sherlock's N (1...
分类:其他好文   时间:2014-07-23 21:03:35    阅读次数:186
HDU 1394 Minimum Inversion Number 树状数组
今天温习树状数组,果然忘记了好多,树状数组求逆序数,值得注意这道题所有的数都是0-n-1的,所以在求最小的时候不用每个数顺序在计算一遍,我已开始就是把每个顺序又计算了一遍,果断超时了。第i个数拿到后面去,逆序数会减少a[i]-1,同时会增加n-a[i] #include #include using namespace std; int a[5005],tree[5005],n; int low...
分类:其他好文   时间:2014-07-23 21:00:35    阅读次数:186
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!