bzoj2438.cc
#include #include #include using namespace std; struct edge { int t; edge *next; }; const int maxn = 100009; const int maxe = 600009; const int maxst = 800009; int n, m, vis[maxn], dfn[maxn], low[maxn], tscc, fs[maxn], ssz[maxn], ind[maxn]; edge ebuf_arr[maxe], *ebuf(ebuf_arr), *head[maxn], *hg[maxn]; inline void addEdge(edge** head, int u, int v) { ebuf-> t = v; ebuf-> next = head[u]; head[u] = ebuf ++; } void tarjanDFS(int po) { static int stc[maxst], stv[maxn], stt[maxn], fr[maxn], d[maxn]; int tsc(1), tsv(0), tst(0), dfi(0); d[stc[tsc] = po] = 1; vis[po] = 1; while (tsc) { int p(stc[tsc –]); if (dfn[p]) continue; for (; tsv && d[p] <= d[stv[tsv]]; – tsv) { low[fr[stv[tsv]]] = min(low[fr[stv[tsv]]], low[stv[tsv]]); if (low[stv[tsv]] == dfn[stv[tsv]]) { ssz[++ tscc] = 0; do { vis[stt[tst]] = 2; ++ ssz[fs[stt[tst]] = tscc]; } while (stt[tst –] !...