摘要:
给一手链接 https://www.luogu.com.cn/problem/P1265 这道题本质上就是最小生成树,题目描述就是prim的思想 TIP:注意稠密图和稀疏图的区别 #include<cstdio> #include<cstring> #include<algorithm> #incl 阅读全文
posted @ 2019-12-07 01:08
友人Aqaq
阅读(230)
评论(0)
推荐(0)
摘要:
给一手链接 https://www.luogu.com.cn/problem/P2865 这道题其实就是在维护最短路的时候维护一下次短路就okay了 #include<cstdio> #include<cstring> #include<algorithm> #include<cmath> #inc 阅读全文
posted @ 2019-12-07 01:04
友人Aqaq
阅读(265)
评论(0)
推荐(0)
摘要:
给一手链接 https://www.luogu.com.cn/problem/P2661 这道题就是 并查集求最小环 TIPS:压缩路径的时候d[x]=d[fa【x】]+d[x],而不是d[x]=d[fa【x】]+1 因为路径是压缩过的 #include<cstdio> #include<cstri 阅读全文
posted @ 2019-12-07 00:58
友人Aqaq
阅读(225)
评论(0)
推荐(0)
摘要:
给一手链接 https://www.luogu.com.cn/problem/P2330 这道题实质就是最小生成树 TIPS:最小生成树不仅是整体权值最小,也是最大边最小 #include<cstdio> #include<cstring> #include<algorithm> #include< 阅读全文
posted @ 2019-12-07 00:53
友人Aqaq
阅读(244)
评论(0)
推荐(0)
摘要:
给一手链接 https://www.luogu.com.cn/problem/P3379 算是lca的模板吧 #include<cstdio> #include<cstring> #include<algorithm> #include<cmath> #include<queue> using na 阅读全文
posted @ 2019-12-07 00:47
友人Aqaq
阅读(264)
评论(0)
推荐(0)
摘要:
给一手链接 https://www.luogu.com.cn/problem/P5018 这道题其实就是用hash水过去的,我们维护两个hash 一个是先左子树后右子树的h1 一个是先右子树后左子树的h2 如果一个点,他的左子树的h1==右子树的h2 那么以这个点为根的树就是对称二叉树了 TIPS: 阅读全文
posted @ 2019-12-07 00:43
友人Aqaq
阅读(254)
评论(0)
推荐(0)
摘要:
给一手链接 https://www.luogu.com.cn/problem/P2786 拿这道题当map模板练练手qwq #include<cstdio> #include<cstring> #include<algorithm> #include<queue> #include<cmath> # 阅读全文
posted @ 2019-12-07 00:40
友人Aqaq
阅读(235)
评论(0)
推荐(0)
摘要:
先上一波链接 https://www.luogu.com.cn/problem/P1168 这道题我们有两种写法 第一种呢是线段树,我们首先需要将原本的数据离散化,线段树维护的信息就是区间内有多少个数, 每次加入两个数(也就是单点修改),查询的时候就是查找中位数((x+1)/2 )所在的位置 每次走 阅读全文
posted @ 2019-12-07 00:27
友人Aqaq
阅读(1091)
评论(0)
推荐(0)