树状数组
www.bilibili.com int n; int a[N]; // 原数组, a[1, n] int c[N]; // 树状数组, c[1, n] // c[i]的区间长度 int lowbit(int x) { return x & (-x); } // 点更新, a[i]加上 x, 更新 c[] void add(int i, int x) { ...
www.bilibili.com int n; int a[N]; // 原数组, a[1, n] int c[N]; // 树状数组, c[1, n] // c[i]的区间长度 int lowbit(int x) { return x & (-x); } // 点更新, a[i]加上 x, 更新 c[] void add(int i, int x) { ...