摘要: 最短路 【HDU】 1548 A strange lift 基础最短路(或bfs)★ 2544 最短路 基础最短路★ 3790 最短路径问题 基础最短路★ 2066 一个人的旅行 基础最短路(多源多汇,可以建立超级源点和终点)★ 2112 HDU Toda... 阅读全文
posted @ 2016-07-25 14:29 adfae 阅读(250) 评论(0) 推荐(0)
摘要: 有向图的Tarjan&缩点void tarjan(int x){ //Tarjan int y = 0; dfn[x]=low[x]=++dindex; instack[x]=true; stap[++stop]... 阅读全文
posted @ 2016-07-21 16:20 adfae 阅读(226) 评论(0) 推荐(0)
摘要: #include#include#include#include#include#include#include#include#include#include//#includeusing namespace std;const int maxn=100010;int dfn[m... 阅读全文
posted @ 2016-07-19 14:35 adfae 阅读(147) 评论(0) 推荐(0)
摘要: 使用Tarjan进行缩点,得到一个SCC图、 这个图有多少个入度为0的,多少个出度为0的。假设有n个入度为0,m个出度为0那么需要给n个点才能传遍所有点,需要加max(n,m)条边才能使整个图变成强连通分量#include#include#include#include#inclu... 阅读全文
posted @ 2016-07-18 20:34 adfae 阅读(220) 评论(0) 推荐(0)
摘要: 给你力量L,求有多少条path的力量小于等于L。这个path消耗的力量是T,T是U到V上最长的边。所以说,只要求得有多少个点对使得点对之间的最大的边小于L即可。采用并查集,离线计算,询问从小到大排序,然后边从小到大排序,然后一个一个加入并查集中,加一条,计算一次两个集合的点的数目的... 阅读全文
posted @ 2016-05-08 18:26 adfae 阅读(141) 评论(0) 推荐(0)
摘要: roblem Description 上次Gardon的迷宫城堡小希玩了很久(见Problem B),现在她也想设计一个迷宫让Gardon来走。但是她设计迷宫的思路不一样,首先她认为所有的通道都应该是双向连通的,就是说如果有一个通道连通了房间A和B,那么既可以通过它从房间A走到房间... 阅读全文
posted @ 2016-05-05 12:48 adfae 阅读(121) 评论(0) 推荐(0)
摘要: #include #include #include #include #include #include #include #include #include #define inf (1>1)using namespace std;#define MAXN 505bool map[MAXN... 阅读全文
posted @ 2016-05-04 22:54 adfae 阅读(134) 评论(0) 推荐(0)
摘要: #include#include#include#include#include#include#includeusing namespace std;const int N=100010;int isin[N],dfn[N],low[N],bel[N];vectorg[N];in... 阅读全文
posted @ 2016-05-03 15:24 adfae 阅读(229) 评论(0) 推荐(0)
摘要: 点击打开链接#include#include#include#include#include#include#includeusing namespace std;#define V 10010#define E 100010#define inf 0x3f3f3f3fstruct Edge{ ... 阅读全文
posted @ 2016-05-02 11:23 adfae 阅读(117) 评论(0) 推荐(0)
摘要: #include#include#include#include#include#includeusing namespace std;const int maxn=2010;struct { int x,y,w,next;}e[maxnq; vis[src]=1; dis[s... 阅读全文
posted @ 2016-05-01 11:27 adfae 阅读(156) 评论(0) 推荐(0)