program spfa; type point=^node; node=record y:longint; z:real; next:point; end; jj=record x,y:longint; end; var i,j,n,m,s,t,x,y:longint; dist:array[0..100] of real; v:array[0..100] of boolean; a:array[0..100] of point; b:array[0..100] of jj; q:array[0..1000000] of longint; procedure insert; var p:point; begin new(p); p^.y:=y; p^.z:=sqrt(sqr(b[x].x-b[y].x)+sqr(b[x].y-b[y].y)); p^.next:=a[x]; a[x]:=p; new(p); p^.y:=x; p^.z:=sqrt(sqr(b[x].x-b[y].x)+sqr(b[x].y-b[y].y)); p^.next:=a[y]; a[y]:=p; end; procedure spfa; var head,tail,x,y:longint; z:real; p:point; begin head:=0; tail:=1; q[1]:=s; v[s]:=true; dist[s]:=0; while head<tail do begin inc(head); x:=q[head]; p:=a[x]; while p<>nil do begin y:=p^.y; z:=p^.z; if dist[y]>dist[x]+z then begin dist[y]:=dist[x]+z; if not v[y] then begin v[y]:=true; inc(tail); q[tail]:=y; end; end; p:=p^.next; end; v[x]:=false; end; end; begin readln(n); for i:=1 to n do readln(b[i].x,b[i].y); readln(m); for i:=1 to n do dist[i]:=9999999; for i:=1 to m do begin readln(x,y); insert; end; readln(s,t); spfa; writeln(dist[t]:0:2); end. /************************************************************** Problem: 2049 User: admin Language: Pascal Result: Wrong Answer ****************************************************************/