树状数组
ToheartZhang
这个作者很懒,什么都没留下…
展开
-
洛谷3374 树状数组1&2
#include<bits/stdc++.h>using namespace std;const int maxn = 500010;int n, m;int a[maxn], c[maxn];inline void update(int x, int k){ while(x <= n){ c[x] += k; x += x & (-x); }原创 2017-08-07 20:59:28 · 250 阅读 · 0 评论 -
洛谷 1908 逆序对
//树状数组 #include<bits/stdc++.h>using namespace std;const int maxn = 100010;int n, s, haoyu[maxn], c[maxn];struct node{ int x, site;} a[maxn];bool cmp(node p, node q){ return p.x < q.x;}voi原创 2017-08-10 16:49:02 · 439 阅读 · 0 评论