求noip2012普及组复赛第4题题解及解题报告!
来源:学生作业帮 编辑:大师作文网作业帮 分类:英语作业 时间:2024/11/06 08:15:40
求noip2012普及组复赛第4题题解及解题报告!
var n,k,m,s,t,i,j,u,v,d,x:longint;
ch,dis,pa,c:array[1..100] of longint;
ch1,ch2,pai:array[1..100,1..100] of longint;
bo:array[1..100,1..100] of boolean;
ins,boo:array[1..100] of boolean;
function cmp(a,b:longint):boolean;
var i:longint;
begin
for i:=1 to pa[c[b]] do
if bo[a,pai[c[b],i]]=true then
exit(false);
exit(true);
end;
procedure spfa;
var head,tail,j:longint;
de:array[1..100] of longint;
begin
head:=0;
tail:=1;
de[tail]:=s;
while headtail do
begin
head:=(head mod n)+1;
ins[de[head]]:=false;
for i:=1 to ch[de[head]] do
if cmp(de[head],ch1[de[head],i]) then
if boo[c[ch1[de[head],i]]] then
if dis[de[head]]+ch2[de[head],i]
ch,dis,pa,c:array[1..100] of longint;
ch1,ch2,pai:array[1..100,1..100] of longint;
bo:array[1..100,1..100] of boolean;
ins,boo:array[1..100] of boolean;
function cmp(a,b:longint):boolean;
var i:longint;
begin
for i:=1 to pa[c[b]] do
if bo[a,pai[c[b],i]]=true then
exit(false);
exit(true);
end;
procedure spfa;
var head,tail,j:longint;
de:array[1..100] of longint;
begin
head:=0;
tail:=1;
de[tail]:=s;
while headtail do
begin
head:=(head mod n)+1;
ins[de[head]]:=false;
for i:=1 to ch[de[head]] do
if cmp(de[head],ch1[de[head],i]) then
if boo[c[ch1[de[head],i]]] then
if dis[de[head]]+ch2[de[head],i]