线段树和树状数组
Waves___
这个作者很懒,什么都没留下…
展开
-
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原创 2016-08-12 19:56:23 · 203 阅读 · 0 评论 -
HDU 1394 Minimum Inversion Number
DescriptionThe inversion number of a given number sequence a1, a2, ..., an is the number of pairs (ai, aj) that satisfy i aj. For a given sequence of numbers a1, a2, ..., an, if we move the f原创 2016-08-12 20:10:45 · 203 阅读 · 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 We can change the matrix in the f原创 2016-08-12 20:13:23 · 234 阅读 · 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 Inpu原创 2016-08-12 19:50:50 · 268 阅读 · 0 评论 -
CodeForces 444C - DZY Loves Colors(线段树)
/*题目链接: http://codeforces.com/contest/444/problem/C题目大意给定一个长度为n的序列,初始时col[i]=i, sum[i]=0 .有两种操作: 1.将区间[L,R]的值改为y,并且当一个数从x改成y时它的权值sum[i]会增加|x-y|. 2.询问区间[L,R]的权值和.参考代码:http://blog.csdn.ne原创 2017-01-20 23:00:46 · 388 阅读 · 0 评论 -
Can you answer these queries (HDU 4027)
https://vjudge.net/problem/HDU-4027题意:给一个数组序列, 数组长度为100000,现在有两种操作, 一种操作是将某一个固定区间所有数开方(向下取整), 另一种操作是询问某个区间的所有数字之和。思路: 当sum[rt] = r-l+1的时候就不需要往下递归了, 其他时候照常#include #includ原创 2017-04-24 18:22:24 · 280 阅读 · 0 评论 -
Range Minimum Queries (CodeChef ANDMIN )
https://vjudge.net/problem/CodeChef-ANDMIN题意: 给n个数,然后有q个操作,有两种输入 1. 0 L R: 查找[L,R]区间内的最小值 2. 1 L R X: 将[L,R]区间内的所有数与X进行与操作,并将得到的值替换原来的值 首先我们可以发现&运算是不可逆的就是说 假设要&的这个x原创 2017-04-24 18:24:44 · 390 阅读 · 0 评论