反图专题

IndiaHacks 2016 - Online Edition (Div. 1 + Div. 2) E. Bear and Forgotten Tree 2 bfs set 反图的生成树 快速连通块

老规矩,抄一波QSC,自己的写在后面   E. Bear and Forgotten Tree 2 题目连接: http://www.codeforces.com/contest/653/problem/E Description A tree is a connected undirected graph consisting of n vertices and n  -  1 edges.

AtcoderBeginerContest245.F EndlessWalk 反图+拓扑排序

|–>传送门<–| 题目大意 给定一个 n n n个节点, m m m条边的简单有向图,问有多少个节点满足作为起点出发时能够到达一个环中。 数据范围 ( n , m ≤ 2 × 1 0 5 ) (n, m \leq 2 \times 10^5) (n,m≤2×105)。 题解 首先容易发现,对于一个图,如果没有向外的一条出边,那么该图上所有的点一定可以进环(感性理解)。 例如上图,