版本比较
【置顶】模板
正文
增加 72 行删除 16 行
3 行未改动45678891011121314151617161819201920212223242122232425262728293031323334353637383940414243444546474849505152535455565758262728293031325960346162636465102 行未改动全部展开1681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992003 行未改动#include <bits/stdc++.h>#define ti chrono::system_clock::now().time_since_epoch().count()#define rep(a,l,r) for(int a=l;a<=r;a++)#define req(a,r,l) for(int a=r;a>=l;a--)#define int long long#define ll long long#define ull unsigned long long#define pf(x) push_front(x)#define pb(x) push_back(x)#define mkp(x,y) make_pair(x,y)#define PII pair<int,int>#define PLL pair<ll,ll>#define fir first#define sec secondusing namespace std;const int INF=1e18;const int INF=1e9;mt19937 gen(ti);uniform_int_distribution<> rnd(1, 1e9);inline int read(){ int x=0,f=1;char ch=getchar(); while (ch<'0'||ch>'9'){if (ch=='-') f=-1;ch=getchar();} while (ch>='0'&&ch<='9'){x=x*10+ch-48;ch=getchar();} return x*f;namespace FastIO { template<typename T>inline void read(T &x) { x=0;int f=1;char c=getchar(); for(;!isdigit(c);c=getchar()) if(c=='-')f=-1; for(;isdigit(c);c=getchar()) x=(x<<1)+(x<<3)+(c^48);x*=f; } inline void read(char &c) { c=getchar(); while(isspace(c)) c=getchar(); } inline void read(std::string &s) { s.clear();char c=getchar(); for(;isspace(c);c=getchar()); for(;!isspace(c)&&c!=EOF;c=getchar()) s+=c; } template<typename T,typename...Args> void read(T &x,Args&...args) { read(x);read(args...); } template<typename T>void print(T x) { if(x<0)x=-x,putchar('-'); if(x>9)print(x/10); putchar((x%10)^48); } inline void print(char c) { putchar(c); } inline void print(std::string s) { rep(i,0,(int)s.size())putchar(s[i]); } inline void print(const char*s) { while(*s)putchar(*s++); } template<typename T,typename...Args> void print(const T &x,const Args&...args) { print(x);print(args...); }}inline void write(int x){ if(x<0) putchar('-'),x=-x; if(x>9) write(x/10); putchar(x%10+'0'); return ;}using namespace FastIO;
signed main()int main(){ return 0;}102 行未改动全部展开 return res;}```::::::info[边双连通分量]```cppint tot,dfn[N],low[N];int cnt,bel[N];int st[N],top;vector<int> col[N];void tarjan(int u,int fae) { low[u]=dfn[u]=++tot; st[++top]=u; for(int i=g1.hd[u];i;i=g1.G[i].nxt) { int v=g1.G[i].v,id=g1.G[i].idx; if(!dfn[v]) { tarjan(v,id); low[u]=min(low[u],low[v]); } else if(id!=fae) low[u]=min(low[u],dfn[v]); } if(low[u]==dfn[u]) { cnt++;int x; do { x=st[top--]; bel[x]=cnt; col[cnt].pb(x); }while(x!=u); }}```:::