cychester

2018年8月30日

可并堆模板

摘要: 1 #include 2 #include 3 #include 4 #define rd read() 5 #define R register 6 using namespace std; 7 8 const int N = 1e5 + 1e4; 9 10 int ch[N][2], dis[N], val[N], f[N]; 11 int n, m; 12 13 i... 阅读全文

posted @ 2018-08-30 14:06 cychester 阅读(146) 评论(0) 推荐(0) 编辑

手工栈样板

摘要: 这是tarjan找环的手工栈, 当作样板, 可以照着打QuQ 神奇的传送门 阅读全文

posted @ 2018-08-30 13:54 cychester 阅读(226) 评论(0) 推荐(0) 编辑

tarjan找基环树的环

摘要: 1 void dfs(int x, int last) { 2 dfn[x] = ++sz; 3 for(int i = head[x]; i; i = e[i].nxt) { 4 if(i == last ^ 1) continue; 5 int nt = e[i].to; 6 if(dfn[nt]) { 7 ... 阅读全文

posted @ 2018-08-30 13:51 cychester 阅读(710) 评论(2) 推荐(1) 编辑

BZOJ 1791: [IOI2008]Island 岛屿 - 基环树

摘要: 传送门 题解 题意 = 找出无向基环树森林的每颗基环树的直径。 我们首先需要找到每颗基环树的环, 但是因为是无向图,用tarjan找环, 加个手工栈, 我也是看了dalao的博客才知道tarjan找无向图环 : dalao的链接 然鹅大佬的方法有一点小问题, 无法找出只有两个节点的环,改动后代码: 阅读全文

posted @ 2018-08-30 13:42 cychester 阅读(538) 评论(0) 推荐(1) 编辑

导航