![](https://img-blog.csdnimg.cn/20201014180756757.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
树状数组
柠栀凉
爱疯爱笑爱胡闹
展开
-
HDU 6318 Swaps and inversions 树状数组
#include<iostream>#include<map>#include<algorithm>#include<cstring>#define ll long longusing namespace std;const int N = 5e5+10;int n;ll c[N];int a[N],b[N];map<...原创 2019-01-27 15:30:19 · 173 阅读 · 0 评论 -
HDU 1556 color the ball 树状数组
#include <bits/stdc++.h>using namespace std;#define N 100009int c[N],n;int lowbit(int i){ return (i&(-i));}void add(int i,int data){ while(i<=n){ c[i]+=data; i+=lowbit(i)...原创 2019-01-26 17:39:22 · 186 阅读 · 0 评论 -
HDU 4325 Flowers 树状数组
#include <bits/stdc++.h>using namespace std;#define NN 100009long long c[NN],n=100005;long long lowbit(long long i){ return (i&(-i));}void add(long long i,long long data){ whil...原创 2019-01-26 17:33:17 · 191 阅读 · 0 评论 -
HDU 1166 敌兵布阵 树状数组
#include <bits/stdc++.h>using namespace std;const int N = 5e4 + 10;int t,n,tmp,i,j;int c[N];int lowbit(int i){ return (i&-i);}void add(int i,int data){ while(i<=n){ ...原创 2019-01-25 14:59:19 · 137 阅读 · 0 评论 -
HDU 4970 Killing Monsters 树状数组
#include <bits/stdc++.h>using namespace std;#define N 100009long long c[N],sum[N],n;long long lowbit(long long x){ return (x&(-x));}void add(long long i,long long d){ while(i...原创 2019-01-25 14:54:40 · 142 阅读 · 0 评论