After the strong Unicom component is determined to determine the degree of 0 points there are several, there are 1 output this component of the number of points, otherwise output 0;
varI,j,n,m,x,y,ans1,ans2,t,cnt,top:longint; HEAD,NEXT,GO,STA,INP:Array[0..50010] ofLongint; Low,dfn,scc,s:Array[0..10000] ofLongint; Flag:Array[0..10000] ofBoolean; functionmin (x,y:longint): Longint; begin ifX<y ThenExit (x)Elseexit (y); End;procedureDFS (k:longint);varI,v,x:longint;beginInc (T);d Fn[k]:=t;low[k]:=T; Inc (top); Sta[top]:=k; I:=Head[k]; whileI<>0 Do beginV:=Go[i]; ifdfn[v]=0 Then beginDfs (v); LOW[K]:=min (low[k],low[v]); End Else ifscc[v]=0 Thenlow[k]:=min (low[k],dfn[v]); I:=Next[i]; End; ifLOW[K]=DFN[K] Then beginInc (CNT); Repeatx:=sta[top];inc (s[cnt]); Dec (top); SCC[X]:=CNT; ifX=k ThenBreak ; untilfalse; End; End;procedureInit;beginreadln (n,m); fori:=1 toM Do beginreadln (x, y); Go[i]:=y;next[i]:=head[x];head[x]:=i; End; fori:=1 toN Do ifdfn[i]=0 ThenDFS (i);End;proceduremain;beginFillchar (flag,sizeof (flag), true); fori:=1 toN Do beginJ:=Head[i]; whileJ<>0 Do beginx:=Go[j]; ifScc[x]<>scc[i] Thenflag[scc[i]]:=false; J:=Next[j]; End; End; fori:=1 toCnt Do ifFlag[i] Then beginInc (ANS1); Ans2:=S[i]; End; ifans1=1 ThenWriteln (ANS2)ElseWriteln (0); End;begininit; main;End.