
树状数组
Lngxling
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
树状数组——三种用法详解
树状数组 树状数组可以视为线段树的一个分枝 树状数组能做的题 线段树基本都能做 但线段树的代码量比较少 容易实现 思想用lowbit 动态维护某一区间的和 求lowbit: lowbit= k & (-k); 在维护和求值时用到了二分的思想 线段树的题基本可以分三种情况 1.点更新 区间查询 2.区间更新 点查询 3.区间更新 区间查询 一,点更新 区间查询(最基本的用法) 在这种用法中 c原创 2017-08-07 21:45:16 · 605 阅读 · 2 评论 -
HDU - 1556 Color the ball —— 区间更新 单点查询
Color the ball Time Limit: 9000/3000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 23519 Accepted Submission(s): 11425 Problem Description N个气球排成一排,原创 2017-09-19 23:08:44 · 396 阅读 · 0 评论 -
POJ - 2155 Matrix —— 二维树状数组
Matrix Time Limit: 3000MS Memory Limit: 65536K Total Submissions: 29525 Accepted: 10783 Description Given an N*N matrix A, whose elements are either 0 or 1. A[i, j]原创 2017-09-19 23:16:56 · 328 阅读 · 0 评论 -
POJ - 2309 BST —— lowbit
BST Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 10348 Accepted: 6334 Description Consider an infinite full binary search tree (see the figure below),原创 2017-09-19 23:33:04 · 365 阅读 · 0 评论 -
HDU - 2689 Sort it
Sort it Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 4980 Accepted Submission(s): 3431 Problem Description You want to proces原创 2017-09-20 22:11:38 · 367 阅读 · 0 评论 -
树状数组求逆序数
每次输入一个数 向后添加进树状数组中 然后向前求和求出之前所有小于这个数的个数 i-这个结果即为这个数之前比这个数大的数的个数 #include #include #include #include #include #include using namespace std; const int max_=1010; int n; int c[max_],num[max原创 2017-09-21 16:33:52 · 199 阅读 · 0 评论 -
POJ - 2299 Ultra-QuickSort —— 逆序对
Ultra-QuickSort Time Limit: 7000MS Memory Limit: 65536K Total Submissions: 65956 Accepted: 24670 Description In this problem, you have to analyze a particular sor原创 2018-02-06 13:01:52 · 302 阅读 · 0 评论