上一页 1 ··· 3 4 5 6 7 8 9 下一页
摘要: 文章来自:https://blog.sengxian.com/algorithms/virtual-tree 本文由于格式问题,插图需要重新打开来看。 概述 在 OI 比赛中,有这样一类题目:给定一棵树,另有多次询问,每个询问给定一些关键点,需要求这些关键点之间的某些信息。询问数可能很多,但满足所有 阅读全文
posted @ 2018-02-21 16:21 mybing 阅读(352) 评论(0) 推荐(0) 编辑
摘要: 文章来源:https://www.cnblogs.com/FuTaimeng/p/5655616.html 倍增算法可以在线求树上两个点的LCA,时间复杂度为nlogn 预处理:通过dfs遍历,记录每个节点到根节点的距离dist[u],深度d[u] init()求出树上每个节点u的2^i祖先p[u] 阅读全文
posted @ 2018-02-21 10:38 mybing 阅读(231) 评论(0) 推荐(0) 编辑
摘要: #include #include #include #include #include #include #include #include using namespace std; int n,m; int f[400001],lin1[400001],lin2[400001],len1=0,len2=0; bool vis[400001]; struct one { int y,n... 阅读全文
posted @ 2018-02-21 09:31 mybing 阅读(146) 评论(0) 推荐(0) 编辑
摘要: 这道题不能用cincout..会RE到你怀疑人生的... 阅读全文
posted @ 2018-02-11 07:07 mybing 阅读(109) 评论(0) 推荐(0) 编辑
摘要: 对于每个节点做一次左偏树dfs就好了,记得加标记。 阅读全文
posted @ 2018-02-09 21:34 mybing 阅读(154) 评论(0) 推荐(0) 编辑
摘要: struct tree { int l,r,w,d; }t[N]; int merge(int k1,int k2) { if(k1==0||k2==0)return k1+k2; if(t[k1].w>t[k2].w)swap(k1,k2); t[k1].r=merge(t[k1].r,k2); if(t[t[k1].l].d<t[t[k1].r].d)swap(t[k1].l,t[... 阅读全文
posted @ 2018-02-09 11:20 mybing 阅读(122) 评论(0) 推荐(0) 编辑
摘要: 注意下传翻转标记,还有在bzoj上不能输出换行符。 阅读全文
posted @ 2018-02-08 08:19 mybing 阅读(130) 评论(0) 推荐(0) 编辑
摘要: 解析:http://www.cnblogs.com/zwfymqz/p/7898210.html 阅读全文
posted @ 2018-02-07 18:30 mybing 阅读(176) 评论(0) 推荐(0) 编辑
摘要: 用manacher搞一搞,然后需要以下区间覆盖的贪心就好了。 阅读全文
posted @ 2018-02-01 16:17 mybing 阅读(154) 评论(0) 推荐(0) 编辑
摘要: #include #include #include using namespace std; const int maxn=1e6+5; char s[maxn*2],str[maxn*2]; int Len[maxn*2],len; void getstr() { int k=0; str[k++]='$'; for(int i=0;ii) Len[i]=min(L... 阅读全文
posted @ 2018-02-01 09:19 mybing 阅读(97) 评论(0) 推荐(0) 编辑
上一页 1 ··· 3 4 5 6 7 8 9 下一页