Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

标程的错误原因猜想

Posted by Hoblovski at 2013-10-03 18:06:37 on Problem 1144
这是DFS的标准过程
anc数组就是low数组。

procedure dfs(i,p,dep:longint);
var tmp:pnode;
    cnt:longint;
begin
col[i]:=1; d[i]:=dep;
anc[i]:=dep; cnt:=0;

tmp:=g[i];
while tmp<>nil do begin
        if (col[tmp^.n]=1)and(tmp^.n<>p)and(anc[tmp^.n]<anc[i]) then anc[i]:=d[tmp^.n];【标程这里应该是写错成了anc[i]=anc[tmp^.n]】
        if (col[tmp^.n]=0) then begin
                inc(cnt); dfs(tmp^.n,i,dep+1);
                if anc[tmp^.n]<anc[i] then anc[i]:=anc[tmp^.n];
                if (i=root)and(cnt>1) then cut[i]:=true;
                if (i<>root)and(anc[tmp^.n]>=d[i]) then cut[i]:=true;
        end;
        tmp:=tmp^.next;
end;
col[i]:=2;
end;

【ancestor数组记录应该是边而不是路径】

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator