
树状数组
jiang_16
一个想学好编程的弱渣妹纸,猎奇,脑洞向...
展开
-
2299 求逆序数对 归并排序/树状数组
n this problem, you have to analyze a particular sorting algorithm. The algorithm processes a sequence of n distinct integers by swapping two adjacent sequence elements until the sequence is sorted in原创 2017-09-25 09:22:27 · 213 阅读 · 0 评论 -
Matrix 二维树状数组 区间修改+单点查询
Given 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 following way. G原创 2017-09-24 16:22:21 · 471 阅读 · 0 评论 -
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原创 2017-09-24 10:41:22 · 751 阅读 · 0 评论 -
数组计算机 单点更新和区间查询
bLue 有一个神器的机器,这个机器可以读入一个数组,并按照用户要求快速地进行数组的处理和计算,它支持如下两种操作: 操作 1:把数组中第 p 个元素的值增加 v。操作 2:计算数组中 [l, r] 区间内所有数的和。 这个机器就是这么的神奇,但是 bLue 的计算机坏掉了,你能帮他修一下吗? Input 输入数据有多组(数据组数不超过 20),到 EOF 结束。 对于每组数原创 2017-09-08 23:05:44 · 227 阅读 · 0 评论 -
Japan 逆序数
Japan 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 East coast and M cities on the West coast (M <= 1000, N <= 10原创 2017-09-25 22:54:43 · 181 阅读 · 0 评论 -
2309 BST
Consider an infinite full binary search tree (see the figure below), the numbers in the nodes are 1, 2, 3, .... In a subtree whose root node is X, we can get the minimum number in this subtree by repe原创 2017-09-27 09:26:43 · 188 阅读 · 0 评论 -
Apple Tree DFS+树状数组
There is an apple tree outside of kaka's house. Every autumn, a lot of apples will grow in the tree. Kaka likes apple very much, so he has been carefully nurturing the big apple tree. The tree has原创 2017-09-28 19:33:05 · 546 阅读 · 0 评论