procedure sconect(var v,outop2:ege;var outop1:stack;var num:integer; var tag,number,low:ary); const n=11; stackmax=100; type stack=array[0..stackmax] of integer; ege=array[1..n,1..n] of integer; ary=array[1..n] of integer; var a,b,i,j,p,q,x,z,w:integer; s,sc:stack; vv:ege; function empty(xx :stack) :boolean; begin empty := (xx[0] = 0) end; function top(xx:stack):integer; begin top:=xx[xx[0]] end; procedure pop(var xx:stack); begin if xx[0]=0 then writeln(lst,'no more stack area') else xx[0]:=xx[0]-1 end; procedure push(var xx:stack; data:integer); begin if xx[0]=stackmax then writeln(lst,'stack overflow') else begin xx[0]:=xx[0]+1; xx[xx[0]]:=data end; end; function second(xx:stack):integer; begin second := xx[xx[0]-1] end; procedure clear(xx :stack); begin xx[0]:=0 end; function number0(var v:integer) :boolean; var i :integer; begin for i := 1 to n do if number[i] = 0 then begin number0 := true; v := i; exit end; number0 := false; end; function unproc(var w:integer) :boolean; var i :integer; begin for i := 1 to n do if (v[top(s),i] = 1) and (vv[top(s),i] = 0) then begin unproc := true; w := i; vv[top(s),i] := 1; end; unproc := false ; end; function min(x,y :integer) :integer; begin if x < y then min := x else min := y end; begin for i:=1 to n do begin number[i]:=0; tag[i]:=0; end; for i:=1 to n do for j:=1 to n do vv[i,j] := 0; clear(s); clear(sc); num:=1; p:=1; q:=1; while number0(x) do begin number[x] := num; num := num + 1; low[x] := number[x]; push(s,x); while not empty(s) do begin while unproc(w) do begin if number[w] = 0 then begin number[w] := num; num := num + 1; low[w] := number[w]; push(s,w) end else if tag[w] = 0 then low[top(s)] := min(low[top(s)],number[w]) end; if low[top(s)] = number[top(s)] then begin tag[top(s)]:=1; outop1[p]:=top(s); while not empty(sc) do begin tag[top(sc)] := 1; outop2[p,q]:=top(sc); pop(sc); q:=q+1 end; q:=1; p:=p+1; end else begin push(sc,top(s)); z := second(s); low[z] := min(low[z],low[top(s)]) end; pop(s); end; end ; end;