比赛 |
20141105 |
评测结果 |
WAWAWAWAWAWAWAWAWAWA |
题目名称 |
月考统计 |
最终得分 |
50 |
用户昵称 |
今天真冷哎 目测一题要E二三要W |
运行时间 |
0.021 s |
代码语言 |
Pascal |
内存使用 |
0.15 MiB |
提交时间 |
2014-11-05 11:29:12 |
显示代码纯文本
{const maxn=500000;
var a,b:Array[0..10000,0..10000]of longint;
f,d:array[1..100000]of longint;
v:array[1..500000]of boolean;
vs:array[1..1000,1..1000]of boolean;
dui:array[1..500000]of longint;
i,j,k,l,m,n,q,p,min,head,tail,new:longint;
procedure work;
begin
readln(n,m);}
{fillchar(vs,sizeof(vs),false);
for i:=1 to n do a[i,0]:=0;
for i:=1 to m do begin readln(p,q,k);a[p,0]:=a[p,0]+1;b[p,q]:=k;
vs[p,q]:=true;}
{a[p,a[p,0]]:=q;a[q,0]:=a[q,0]+1;
a[q,a[q,0]]:=p;
b[q,p]:=-1*k;
end; }
{fillchar(v,sizeof(v),false);
fillchar(f,sizeof(f),$7f);
f[1]:=0;
head:=1;min:=maxlongint;
tail:=1; dui[1]:=1; v[1]:=true;
while head<=tail do begin
new:=dui[head mod maxn];
for i:=1 to a[new,0] do begin
if f[i]>f[new]-b[new,i] then
begin
f[i]:=f[new]-b[new,i];
if not(v[i]) then begin inc(tail);dui[tail mod maxn]:=i;v[i]:=true;end;
end;
end;
inc(head); v[new]:=false;
end;
for i:=1 to n do if f[i]<min then begin min:=f[i];k:=i;end; }
{for k:=1 to n do begin
for i:=1 to n do d[i]:=maxlongint;
fillchar(v,sizeof(v),false);
d[k]:=0;
head:=1;min:=maxlongint;
tail:=1; dui[1]:=k; v[k]:=true;
while head<=tail do begin
new:=dui[head mod maxn];writeln(head);
for i:=1 to n do begin
if v[new,i] then begin
if d[i]>d[new]-b[new,i] then
begin
d[i]:=d[new]-b[new,i];
if not(v[i]) then begin inc(tail);dui[tail mod maxn]:=i;v[i]:=true;end;
end; end;
if v[i,new] then begin
if d[i]>d[new]-b[new,i] then
begin
d[i]:=d[new]-b[new,i];
if not(v[i]) then begin inc(tail);dui[tail mod maxn]:=i;v[i]:=true;end;
end; end;
end;
end;
inc(head);v[new]:=false;
end;
for i:=1 to n do
if d[i]<0 then continue;
for i:=1 to n do write(d[i],' ');
exit;
end;
for i:=1 to a[1,0] do write(a[1,i]);}
begin
assign(input,'ExamStat.in');
assign(output,'ExamStat.out');
reset(input);
rewrite(output);
writeln('SOMEONE LAY!'); close(input);close(output);
end.