2012年6月28日

poj 3180 The Cow Prom

摘要: http://poj.org/problem?id=3180题意:给一个无向图,求出节点数据大于1的边通分量有多少个。思路:直接tarjan缩点统计。View Code #include<stdio.h>#include<string.h>#include<stdlib.h>#include<stack>#include<iostream>#include<utility>using namespace std;const int maxn = 10005;struct nd{ int v,next;}edge[maxn* 阅读全文

posted @ 2012-06-28 13:41 aigoruan 阅读(174) 评论(0) 推荐(0)

poj 3114 Countries in War

摘要: http://poj.org/problem?id=3114题目大意:战争期间的通信问题,同一个国家的城市间可以互相通信,距离可视为零,不同国家的城市间根据所给路径,求解最短路.思路:对于有向图中的环,先进行缩点重建图,然后对每个点直接spfa。注意:重建图后不一定是棵树,所以不能用lca。View Code #include<stdio.h>#include<string.h>#include<stdlib.h>#include<stack>#include<iostream>#include<utility>using 阅读全文

posted @ 2012-06-28 13:13 aigoruan 阅读(141) 评论(0) 推荐(0)

导航