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 1162. Currency Exchange

What's wrong with my code? Give me any hint, please!
Posted by Wrong Limit Acces Violation 4 Apr 2005 20:47
 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.
Hmm... It was stupid mistake. Now it's AC.
Posted by Wrong Limit Acces Violation 4 Apr 2005 20:58