
树状数组
文章平均质量分 78
明天--会更好
规划努力总结
展开
-
HDU 2689 Sort it(树状数组)(类似逆序数,同样不需要离散化)
Problem DescriptionYou want to processe a sequence of n distinct integers by swapping two adjacent sequence elements until the sequence is sorted in ascending order. Then how many times it need.Fo原创 2013-08-21 13:43:03 · 808 阅读 · 0 评论 -
HDU 2492 Ping pong (树状数组+离散化+找规律)
Problem DescriptionN(3<=N<=20000) ping pong players live along a west-east street(consider the street as a line segment).Each player has a unique skill rank. To improve their skill rank, they原创 2013-08-25 12:49:50 · 523 阅读 · 0 评论 -
HDU 1166 敌兵布阵(数状数组)第一种:每次修改的是一个点,所求的是关于某段区间
Problem DescriptionC国的死对头A国这段时间正在进行军事演习,所以C国间谍头子Derek和他手下Tidy又开始忙乎了。A国在海岸线沿直线布置了N个工兵营地,Derek和Tidy的任务就是要监视这些工兵营地的活动情况。由于采取了某种先进的监测手段,所以每个工兵营地的人数C国都掌握的一清二楚,每个工兵营地的人数都有可能发生变动,可能增加或减少若干人手,但这些都逃不过C国的监视原创 2013-08-12 20:16:31 · 589 阅读 · 0 评论 -
HDU 1556 Color the ball 树状数组第二种:每次修改的是一个区间,所求的值是关于某个点的
Problem DescriptionN个气球排成一排,从左到右依次编号为1,2,3....N.每次给定2个整数a b(a Input每个测试实例第一行为一个整数N,(N 当N = 0,输入结束。Output每个测试实例输出一行,包括N个整数,第I个数代表第I个气球总共被涂色的次数。Sample Input31 12 23 33原创 2013-08-13 10:53:08 · 679 阅读 · 0 评论 -
树状数组小结及其注意事项
树状数组中用的d【】,每个点都有一定的管辖范围;如d[1]=a[1];d[2]=a[1]+a[2];d[3]=a[3];d[4]=a[1]+a[2]+a[3]+a[4];等等;这样的结构关键是为了,对一个数组内部动态的删除,增加,来高效的求某个点或者某个区间的值;比如说对数组a,改变某一位的值需O(1),求某个k区间值O(k);这样的原创 2013-08-13 10:44:59 · 515 阅读 · 0 评论 -
HDU 1892 See you~(经典二维树状数组)
Problem DescriptionNow I am leaving hust acm. In the past two and half years, I learned so many knowledge about Algorithm and Programming, and I met so many good friends. I want to say sorry to Mr,原创 2013-08-22 17:09:23 · 649 阅读 · 0 评论 -
HDU 1541 Stars (树状数组)
Astronomers 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 not higher and原创 2013-08-22 17:32:47 · 521 阅读 · 0 评论 -
HDU 2642 Stars(二维树状数组)
Problem DescriptionYifenfei is a romantic guy and he likes to count the stars in the sky.To make the problem easier,we considerate the sky is a two-dimension plane.Sometimes the star will be brigh原创 2013-08-22 17:19:36 · 610 阅读 · 0 评论 -
HDU 2688 Rotate(树状数组---求正序数)
Problem DescriptionRecently yifenfei face such a problem that give you millions of positive integers,tell how many pairs i and j that satisfy F[i] smaller than F[j] strictly when i is smaller than j原创 2013-08-21 13:27:03 · 877 阅读 · 0 评论 -
2013暑假江西联合训练赛(赛后) 二进制求和 (树状数组,这里需要变形下)
Problem Description平时我们经常会将一个数用二进制的形式来表示,我们用 BSUM(X) 表示X用二进制形式表示中1的个数。现在给你一个长度为n (n1 a b (12 a b (13 a b (1Input第一行输入T(每组测试先输入一行n,下一行输入n个数a[i](1然后输入q表示询问次数接下来q行代表每次询问。 Sample Input原创 2013-09-02 19:43:03 · 1436 阅读 · 0 评论