求noip2012普及组复赛第4题题解及解题报告!
来源:学生作业帮 编辑:搜搜考试网作业帮 分类:英语作业 时间:2024/06/25 13:01:55
求noip2012普及组复赛第4题题解及解题报告!
![求noip2012普及组复赛第4题题解及解题报告!](/uploads/image/z/17317186-34-6.jpg?t=%E6%B1%82noip2012%E6%99%AE%E5%8F%8A%E7%BB%84%E5%A4%8D%E8%B5%9B%E7%AC%AC4%E9%A2%98%E9%A2%98%E8%A7%A3%E5%8F%8A%E8%A7%A3%E9%A2%98%E6%8A%A5%E5%91%8A%21)
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]