![](https://img-blog.csdnimg.cn/20201014180756738.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
数据结构_线段树
文章平均质量分 50
wang2147483647
这个作者很懒,什么都没留下…
展开
-
Codeforces Round #197 (Div. 2) D. Xenia and Bit Operations(线段树)
题目地址:http://codeforces.com/problemset/problem/339/D 思路:线段树。PushUp时根据层数奇数偶数判断使用|还是^ #include #include #include #include #include using namespace std; #define maxn (1<<18) int a[maxn]; int sum[ma原创 2016-07-26 10:16:02 · 481 阅读 · 0 评论 -
Hdu 5023 A Corrupt Mayor's Performance Art(线段树+状压)
题目地址:http://acm.hdu.edu.cn/showproblem.php?pid=5023 思路:用一30位数每一位表示有某个颜色,使用线段树进行区间修改与查询。最后某位为1,则存在该种颜色。 #include #include #include #include #define lson l,m,rt<<1 #define rson m+1,r,rt<<1|1 #define r原创 2016-11-15 20:51:46 · 446 阅读 · 0 评论 -
Hdu 4417 Super Mario(主席树+二分)
题目地址:http://acm.split.hdu.edu.cn/showproblem.php?pid=4417 思路: 1.查询区间内不大于x的数的个数。 2.使用主席树求区间k大值,二分k,求最后一个不大于x的k大值,则k即为元素个数。 #include #include #include #include #define lson l,m #define rson m+1,r #d原创 2017-10-12 19:31:57 · 564 阅读 · 0 评论