Loading

随笔分类 -  树状数组

摘要:描述 传送门:我是传送门 White Rabbit has a rectangular farmland of n*m. In each of the grid there is a kind of plant. The plant in the j-th column of the i-th ro 阅读全文
posted @ 2021-01-20 21:35 Yiduuannng 阅读(83) 评论(0) 推荐(0)
摘要:描述 传送门:我是传送门 Given a sequence of integers a1,a2,…,ana1,a2,…,an and qq pairs of integers (l1,r1),(l2,r2),…,(lq,rq)(l1,r1),(l2,r2),…,(lq,rq), find count 阅读全文
posted @ 2021-01-20 20:49 Yiduuannng 阅读(129) 评论(0) 推荐(0)
摘要:描述 参考资料:我是传送门 一维树状数组的差分写法 二维树状数组 注意要差分处理 一维树状数组 (1). 单点修改+区间查询 (2). 区间修改+单点查询 // 给位置p增加x<br /> void add(int p,int x) { while(p &lt;= n) sum[p] += x,p 阅读全文
posted @ 2021-01-20 20:47 Yiduuannng 阅读(77) 评论(0) 推荐(0)