Noip图论整理素材.doc

图论程序整理 Edmonds-Karp var ans,i,j,k,s,t,tot,m,n,a,b,c:longint; u,v,w,next,other:array[0..200] of longint; point,d,q,pre:array[0..200] of longint; function min(a,b:longint):longint; begin if ab then exit(b) else exit(a); end; procedure add_edge(a,b,c:longint); begin inc(k);u[k]:=a;v[k]:=b;w[k]:=c; next[k]:=point[a];point[a]:=k;other[k]:=k+1; inc(k);u[k]:=b;v[k]:=a;w[k]:=0; next[k]:=point[b];point[b]:=k;other[k]:=k-1; end; function found:boolean; var j,head,tail:longint; begin head:=0;tail:=1;q[1]:=s; fillchar(d,sizeof(d),127); d[s]:=0; while headtail do begin inc(head); j:=p

文档评论(0)

1亿VIP精品文档

相关文档