数据结构
文章平均质量分 75
lwqq3
这个作者很懒,什么都没留下…
展开
-
BZOJ1588: [HNOI2002]营业额统计(splay)
splay模板题 注意一下没有前驱和后驱的情况#include <stdio.h>#include <algorithm>#include <iostream>using namespace std;int rt, cnt, sz;int ch[40005][2];int cn[40005];int fa[40005];int val[40005...原创 2018-03-06 14:26:33 · 157 阅读 · 0 评论 -
LOJ#6285. 数列分块入门 9(分块)
题意 查询区间最小众数死啃了clj的区间众数解题报告... 真实太强辣 还有一个logn的优化 没学会 待填坑大概就是分块 然后枚举最多2根号n + 1个元素 询问这些元素在这个区间出现了多少次先预处理同一个元素在数组中出现的位置 存入容器中 然后二分查询即可#include <stdio.h>#include <algorithm>#include <iostr...原创 2018-03-15 11:19:37 · 930 阅读 · 0 评论 -
BZOJ1208: [HNOI2004]宠物收养所(splay)
splay模板题 调了好久啊TAT#include <stdio.h>#include <algorithm>#include <iostream>#include <cmath>using namespace std;int ch[80005][2];int fa[80005];int val[80005];int cn[80005...原创 2018-03-06 11:41:14 · 264 阅读 · 0 评论 -
BZOJ3224: Tyvj 1728 普通平衡树 (splay)
splay模板题 学习了zyf2000的博客 万分感谢!#include <stdio.h>#include <algorithm>#include <iostream>using namespace std;int rt, cnt;int so[100005][2];int fa[100005];int sz[100005];int cn[10...原创 2018-03-06 11:47:08 · 208 阅读 · 0 评论 -
codeforces940F. Machine Learning(带修莫队)
带修莫队有点裸 因为感觉再暴力求mex的时候感觉不会太大 最多就是个常数级带修莫队还写的不够熟 TLE了好久 注意下分块的大小 以及带关键字的排序很奇怪这个题明明都是1e5的数据范围 开1e5的数组大小会re 所以都开的2e5 (⊙﹏⊙)#include <stdio.h>#include <algorithm>#include <iostream>#in...原创 2018-03-22 10:50:01 · 306 阅读 · 1 评论 -
codeforces766E. Mahmoud and a xor trip(DP)
题意:给定一棵树 每个节点有权值 任意选两个点i和j满足i<=j其贡献为i到j路径所有点的xor和 求所用点对的和题解:感觉带xor的题从位运算考虑会好很多 于是对于每个点枚举每一位 对于每一位dp[i][0]表示从i点开始这一位xor和为0的路径数 那么dp[i][1]同理设j为这个点的儿子 那么转移就把他所有儿子的贡献加起来 如果i这一位为0 dp[i][0] += dp[j][0], ...原创 2018-04-16 23:54:31 · 254 阅读 · 0 评论