
缩点
文章平均质量分 75
ehi11
这个作者很懒,什么都没留下…
展开
-
The Busiest Man 强连通分量+缩点+传递闭包 !
/*强连通分量+缩点+传递闭包。有n种物品,现给出m种关系,每种关系a,b对应着物品b能够用物品a来换,然后有q个询问(a,b),问物品a能不能换到物品b。刚开始是判断两个点是否在一个连通分量里,后来想下题目有问单向可达即可,判连通分量范围太小,是错的。这题直接搜索也能过。但是如果qui传递闭包的话,直接用floyed超时。可以先缩点,再对新图求传递闭包。这是一类关系问题中的单向连通。是一类有代表原创 2012-08-17 19:30:09 · 1776 阅读 · 0 评论 -
The Bottom of a Graph 强连通分量加缩点
/*题意比较晦涩,大致就是求一个图缩点后出度为0的点的个数。*/#include #include #include #include using namespace std;vector e[5010];int dfn[5001];int low[5001];int stack[5001];bool instack[5001];int belong[5001];int原创 2012-08-20 08:52:51 · 1408 阅读 · 1 评论 -
LRJ白书图论 11324 - The Largest Clique uva
/* 题意:给一张有向图,求这样的一个点集,使得集合中的点u,v,u->v,or v->u,or,uv。 对图缩点,构造一张DAG。在DAG上作dp最长路。 点权为每个强连通分量重节点的个数。*/#include #include #include #include using namespace std;const int maxn=1010;const int原创 2013-05-04 08:37:43 · 1332 阅读 · 0 评论