网站制作知识
[luoguP1168]中位数(主席树+离散化)
2025-01-03 14:13  点击:0

传送门

模板题一道,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