
树状数组
柠栀凉
爱疯爱笑爱胡闹
展开
-
HDU 6318 Swaps and inversions 树状数组
#include<iostream> #include<map> #include<algorithm> #include<cstring> #define ll long long using namespace std; const int N = 5e5+10; int n; ll c[N]; int a[N],b[N]; map<...原创 2019-01-27 15:30:19 · 230 阅读 · 0 评论 -
HDU 1556 color the ball 树状数组
#include <bits/stdc++.h> using namespace std; #define N 100009 int 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 · 227 阅读 · 0 评论 -
HDU 4325 Flowers 树状数组
#include <bits/stdc++.h> using namespace std; #define NN 100009 long 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 · 236 阅读 · 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 · 168 阅读 · 0 评论 -
HDU 4970 Killing Monsters 树状数组
#include <bits/stdc++.h> using namespace std; #define N 100009 long 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 · 175 阅读 · 0 评论