ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1210. Kind Spirits

Can You please help me - i'm a beginner ...
Posted by Ibrahim Lyuondula 22 Feb 2003 02:56
i think that my program can't be wrong it's so simple ?! but it
always gets WA ?! please help me.  thank You!

var
odl:array[0..30,0..30]of longint;
j,k,i,ilep,min,doo,dl:longint;
zn:char;
begin
readln(ilep);
for i:=1 to 30 do
 for j:=1 to 30 do
  odl[i,j]:=1000000000;
min:=maxlongint;
odl[0,1]:=0;

 for i:=1 to ilep do
  begin
   readln(doo);
    for j:=1 to doo do
     begin
     read(k);
      while k<>0 do
       begin
        read(dl);
        if (odl[i,j]>odl[i-1,k]+dl)and(odl[i-1,k]<>1000000000) then
          begin
           odl[i,j]:=odl[i-1,k]+dl;
           if (i=ilep) and(odl[i,j]<min)then min:=odl[i,j]
          end;
        read(k)
       end;
     end;
    if i<>ilep then readln(zn)
  end;
writeln(min)
end.