[luoguP1168]中位数(主席树+离散化)


传送门

模板题一道,1A。

——代码

1 #include <cstdio> 2 #include <algorithm> 3 #define ls son[now][0], l, mid 4 #define rs son[now][1], mid + 1, r 5 6 using namespace std; 7 8 const int N = 100005; 9 10 int n, sz, tot; 11 int a[N], b[N], sum[20 * N], rt[20 * N], son[20 * N][2]; 12 13 inline void build(int &now, int l, int r) 14 21 22 inline void update(int &now, int l, int r, int last, int x) 23 33 34 inline int query(int now, int l, int r, int x) 35 41 42 int main() 43 56 return 0; 57 }
View Code



上一篇:[HNOI2004]宠物收养场(Treap)

下一篇:[HDU3062]Party(2-sat)


主席树 离散化
Copyright © 2002-2019 k262电脑网 www.k262.cn 皖ICP备2020016292号
温馨提示:部分文章图片数据来源与网络,仅供参考!版权归原作者所有,如有侵权请联系删除!QQ:251442993 热门搜索 网站地图