Strong Unicom Tarjan Some of the black technology and random thoughts

Source: Internet
Author: User

I do not want the face of the direct Amway ATP Big Man's blog (forgive me the old yz habit of the girls called the Big Guy)

Put some ban (suddenly think of a pesticide) son.

intz,dfn[110000],low[110000];inttop,sta[110000];BOOLv[110000];intcnt,belong[110000];voidStrong_unicom (intx) {Dfn[x]=low[x]++Z; sta[++top]=x;v[x]=true;  for(intk=last[x];k;k=A[k].next) {        inty=a[k].y; if(dfn[y]==0) {strong_unicom (y); LOW[X]=min (low[x],low[y]); }        Else        {            if(v[y]==true) Low[x]=min (low[x],dfn[y]); }    }    if(dfn[x]==Low[x]) {        inti;cnt++;  Do{i=sta[top];top--; V[i]=false; Belong[i]=CNT; } while(i!=x); }}//----------------function--------------------Z=top=cnt=0; memset (DFN,0,sizeof(DFN)); memset (Low,0,sizeof(low)); memset (V,false,sizeof(v));  for(intI=1; i<=n;i++)        if(dfn[i]==0) strong_unicom (i);//------------------Main-------------------
the strong unicom of the base (is also posing)

Once we all had a problem.
Low[x]=min (Low[x],dfn[y]); Change to Low[x]=min (Low[x],low[y]);
Can also AC, now understand, is to emphasize the meaning of cutting point.

intz,dfn[110000],low[110000],cut[110000];voidFindcut (intx) {Dfn[x]=low[x]=++Z;  for(intk=last[x];k;k=A[k].next) {        inty=a[k].y; if(dfn[y]==0) {findcut (y); LOW[X]=min (low[x],low[y]); if(Low[y]>=dfn[x]) cut[x]++; }        Elselow[x]=min (low[x],dfn[y]); }}//----------------function--------------------z=0; memset (DFN,0,sizeof(DFN)); memset (Low,0,sizeof(low)); memset (Cut,0,sizeof(cut));  for(intI=1; i<=n;i++)        if(dfn[i]==0) findcut (i); Elsecut[i]++;//------------------Main-------------------
number of cut points for a point to be connected (bzoj2730 mine construction)

Strong Unicom Tarjan Some of the black technology and random thoughts

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.