随笔分类 - 树状数组
摘要:题意: 给出一个数组,元素有正有负有0,问其区间和小于 t 的子区间的个数。 sum[ r ]-sum[ l-1 ]<t,其中sum是a的前缀和。 实现的方法就是从前往后对于每一个sum[ i ],看在它前面有多少个大于等于sum[ i ] - t 的前缀和。 树状数组维护的是 i 前面有几个数小于
阅读全文
摘要:Every year, Farmer John's N (1 <= N <= 20,000) cows attend "MooFest",a social gathering of cows from around the world. MooFest involves a variety of e
阅读全文
摘要: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 carefu
阅读全文
摘要:Farmer John's cows have discovered that the clover growing along the ridge of the hill (which we can think of as a one-dimensional number line) in his
阅读全文
摘要:Suppose that the fourth generation mobile phone base stations in the Tampere area operate as follows. The area is divided into squares. The squares fo
阅读全文
摘要: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
阅读全文
摘要: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
阅读全文
摘要:In this problem, you have to analyze a particular sorting algorithm. The algorithm processes a sequence of n distinct integers by swapping two adjacen
阅读全文
摘要:题目是让每次对一个子矩阵进行翻转(0变1,1变0), 然后有多次询问,询问某个点是0还是1 这题可以用二维的树状数组来解决,考虑传统的树状数组是改变某个点,然后查询某一段, 而这个题是改变某一段,查询某个点,需要进行一下转换,将原来的改值变成查询, 查询变成改值。改制时相当于对区间分别进行修改,而查
阅读全文

浙公网安备 33010602011771号