随笔分类 -  提高组模板

摘要:Dfs(int rt){ f[0][rt]; for(int k=1;k=0;k--) if((1=0;k--){ if(f[k][x]!=f[k][y]) x=f[k][x],y=f[k][y]; } return f[0][x]; } 阅读全文
posted @ 2019-08-06 16:19 DreamingBligo_Tido 阅读(161) 评论(0) 推荐(0)
摘要:最好还是看一看下面这个网址吧 我的这篇博客里的代码更加缜密(毫无错误的神级代码)https://www.cnblogs.com/Tidoblogs/p/11315153.html https://www.sohu.com/a/245954819_100201031 阅读全文
posted @ 2019-07-21 22:29 DreamingBligo_Tido 阅读(145) 评论(0) 推荐(0)
摘要:拓扑排序 拓扑图:有向⽆环图 在拓扑序中,所有指向x点的边的起点,都在x点之前。 伪代码: 将⼊度为0的点加⼊队列 while(l<r){ int x=q[++l]; for(int i=point[x];i;i=next[i]) //这是邻接表的写法,也可以转化为vector { in[to[i] 阅读全文
posted @ 2019-07-21 19:27 DreamingBligo_Tido 阅读(483) 评论(0) 推荐(0)
摘要:SPFA判负环 BFS 当⼀个点⼊队超过n次 则存在负环 慢! DFS 当⼀个点在最短路中出现两次 快! 阅读全文
posted @ 2019-07-21 19:24 DreamingBligo_Tido 阅读(177) 评论(0) 推荐(0)
摘要:// // dijkstra妯℃澘.cpp // algorithm // // Created by david.xu on 2018/8/6. // Copyright 漏 2018骞?david.xu. All rights reserved. //当一个点入队超过n次则存在负环BFS //快:DFS当一个点在最短路中出现两次 #include #include #incl... 阅读全文
posted @ 2019-07-21 19:20 DreamingBligo_Tido 阅读(245) 评论(0) 推荐(0)
摘要:// // dijkstra妯℃澘.cpp // algorithm // // Created by david.xu on 2018/8/6. // Copyright 漏 2018骞?david.xu. All rights reserved. // //不能有负边权! #include #include #include #include #include #incl... 阅读全文
posted @ 2019-07-21 19:19 DreamingBligo_Tido 阅读(194) 评论(0) 推荐(0)
摘要:int gcd(int a,int b) { if(b==0) return a; return gcd(b,a%b); } 阅读全文
posted @ 2019-07-21 00:17 DreamingBligo_Tido 阅读(105) 评论(0) 推荐(0)
摘要://应用条件:不能修改! 阅读全文
posted @ 2019-07-21 00:13 DreamingBligo_Tido 阅读(144) 评论(0) 推荐(0)
摘要:求x^n 阅读全文
posted @ 2019-07-21 00:07 DreamingBligo_Tido 阅读(109) 评论(0) 推荐(0)
摘要:int l=0,r=inf; while(l>1; if(pd(mid)){ ans=mid; r=mid-1; } else l=mid+1; } 阅读全文
posted @ 2019-07-21 00:02 DreamingBligo_Tido 阅读(139) 评论(0) 推荐(0)
摘要://https://www.luogu.org/problemnew/show/P3379#include<bits/stdc++.h> #define maxn 500010 #define maxm 1000010 using namespace std; struct edge{ int to 阅读全文
posted @ 2019-07-20 12:02 DreamingBligo_Tido 阅读(163) 评论(0) 推荐(0)