What's wrong with my code? Give me any hint, please!
I have WA on #10.
Here is a prog:
type
long = record x,y : longint; rx,cx,ry,cy : real; end;
var
d : array [1..100] of real;
a : array [1..100] of long;
i,j,n,m,s : longint;
procedure inp;
begin
fillchar(d,sizeof(d),0);
read(n,m,s,d[s]);
for i := 1 to m do
with a[i] do read(x,y,rx,cx,ry,cy);
end;
procedure find;
begin
for i := 1 to n-1 do
for j := 1 to m do
begin
if ((d[a[j].x]-a[j].cx)*a[j].rx > d[a[j].y])
then d[a[j].y] := (d[a[j].x]-a[j].cx)*a[j].rx;
if ((d[a[j].y]-a[j].cy)*a[j].ry > d[a[j].x])
then d[a[j].x] := (d[a[j].y]-a[j].cy)*a[j].ry;
end;
end;
procedure out;
begin
for i := 1 to m do
begin
if ((d[a[i].x]-a[i].cx)*a[i].rx > d[a[i].y])
then begin writeln('YES'); halt; end;
if ((d[a[i].y]-a[i].cy)*a[i].ry > d[a[i].x])
then begin writeln('YES'); halt; end;
end;
writeln('NO');
end;
begin
inp;
find;
out;
end.