cychester

随笔分类 -  拓扑排序

Luogu3119 草鉴定-Tarjan+Topsort
摘要:Solution 简单的$Tarjan$题。 有大佬现成博客 就不写了 → 传送门 Code 1 #include<cstdio> 2 #include<cstring> 3 #include<algorithm> 4 #include<queue> 5 #define rd read() 6 us 阅读全文

posted @ 2018-10-18 16:33 cychester 阅读(207) 评论(0) 推荐(0)

Luogu2149 [SDOI2009]Elaxia的路线-最短路+拓扑排序
摘要:Solution 另外$ m <=5e5$。 两条最短路的 最长公共路径 一定是若干条连续的边, 并且满足拓扑序。 于是我们分别 正向 和反向走第二条路径,若该条边同时是两条最短路径上的边, 则加入边集。 最后拓扑 求最长链即可 Code 1 #include<cstring> 2 #include 阅读全文

posted @ 2018-10-16 14:24 cychester 阅读(204) 评论(0) 推荐(0)

导航