树状数组
树状数组可以在O(logn)的时间复杂度内求出前缀和||插入一个数
树状数组的三种基本模板
区间查询+单点修改 将a[i]最为树状数组中的每个元素
题目链接
#include<iostream>
#include<cstdio>
using namespace std;
int n,m;
const int N=1000010;
int tr[N];
int lowbit(int x){
return x&-x;
}
void add(int x,int v
原创
2020-08-30 17:03:09 ·
93 阅读 ·
0 评论