摘要: 1 /* 2 求割边,暴力LCA 3 */ 4 5 // include file 6 #include <cstdio> 7 #include <cstdlib> 8 #include <cstring> 9 #include <cmath> 10 #include <cctype> 11 #include <ctime> 12 13 #include <iostream> 14 #include <sstream> 15 #include <fstream> 16 #include 阅读全文
posted @ 2011-03-14 14:56 AC2012 阅读(706) 评论(0) 推荐(0) 编辑
摘要: 1 /* 2 用边来保存点连通分量似乎更好理解 3 */ 4 5 6 7 // include file 8 #include <cstdio> 9 #include <cstdlib> 10 #include <cstring> 11 #include <cmath> 12 #include <cctype> 13 #include <ctime> 14 15 #include <iostream> 16 #include <sstream> 17 #include <fstream> 阅读全文
posted @ 2011-03-14 12:54 AC2012 阅读(175) 评论(0) 推荐(0) 编辑
摘要: 1 /* 2 题目大意是:一些骑士,他们都有自己的仇人,所以安排座位的时候,必须邻座没有仇人。 3 但是某些人可能无法安排座位,问无法安排座位的人有多少个 4 5 解法:把所有的仇人关系建立图,求补图,在补图中,所有连接边的两个顶点可以做邻居 6 这个图可能存在割点,所以我们要找出连通分量,如果连通分量存在奇圈,那么可以满足,如果不存在 7 去除所有该连通分量的人 8 9 最后输出去除的人数 10 11 这道题让我知道了我写的点连通分量是有问题的,在碰到割点的时候,从栈中输出分量,碰到割点连接的儿子的时候停止 12 可是我写的是当下一个点是割点的时候停止,就这一点小小的不同,就一直WA.现在. 阅读全文
posted @ 2011-03-14 10:10 AC2012 阅读(451) 评论(0) 推荐(0) 编辑