首先为了偷懒就打了个floyd，然后。。。60分QAQ
所以还是得用dij啦~
CODE：（floyd懒得删）
const maxd=maxlongint;
var st,en,q:longint;
k,m,n,i,j:longint;
a:array[1..100,1..100] of int64;
procedure dij;
var i,j:longint;
dist:array[0..120] of int64;
used:array[0..120] of boolean;
k,best:int64;
begin
for i:=1 to n do begin
dist[i]:=a[st,i];used[i]:=false;
end;
dist[st]:=0;
used[st]:=true;
for i:=1 to n-1 do begin
best:=maxd;
for j:=1 to n do begin
if not used[j] and (dist[j]<=best) then begin
k:=j;best:=dist[j];
end;
end;
used[k]:=true;
for j:=1 to n do
if not used[j] and (dist[k]+a[k,j]<dist[j]) then begin
dist[j]:=dist[k]+a[k,j];
end;
end;
if dist[en]=maxd then writeln(-1) else writeln(dist[en]);
end;

procedure floyd;
var x,i,j:longint;
begin
for x:=1 to n do
for i:=1 to n do
for j:=1 to n do
if a[i,j]>a[i,x]+a[x,j] then a[i,j]:=a[i,x]+a[x,j];
end;
begin
readln(n,m);
for i:=1 to n do
for j:=1 to n do a[i,j]:=maxd;
for i:=1 to m do begin
read(q,st,en);
if q=1 then begin
read(k);
if k<a[st,en] then begin
a[st,en]:=k;
a[en,st]:=k;
end;
end;
if q=0 then
dij;
readln;
end;
end.