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 1193. Queue at the Exam

SO help me!! i tried to understand but still WA! :P
Posted by Locomotive 13 Jan 2003 18:39
Var
  a                   :array[0..100,1..3] of integer;
  i,j,n               :byte;
  now,ans             :integer;
begin
  readln(n);
  for i:=1 to n do readln(a[i,1],a[i,2],a[i,3]);
  for i:=1 to n-1 do
    for j:=i+1 to n do
      if a[i,1]>a[j,1] then begin
        a[0]:=a[i]; a[i]:=a[j]; a[j]:=a[0]; end;
  ans:=0; now:=a[1,1];
  for i:=1 to n do begin
    now:=now+a[i,2];
    if now-a[i,3]>ans then ans:=now-a[i,3];
  end;
  writeln(ans);
end.


What is goin` wrong???
DOnt WAste YOur TIme! I GOt AC ....!
Posted by Locomotive 13 Jan 2003 18:59
> Var
>   a                   :array[0..100,1..3] of integer;
>   i,j,n               :byte;
>   now,ans             :integer;
> begin
>   readln(n);
>   for i:=1 to n do readln(a[i,1],a[i,2],a[i,3]);
>   for i:=1 to n-1 do
>     for j:=i+1 to n do
>       if a[i,1]>a[j,1] then begin
>         a[0]:=a[i]; a[i]:=a[j]; a[j]:=a[0]; end;
>   ans:=0; now:=a[1,1];
>   for i:=1 to n do begin
>     now:=now+a[i,2];
>     if now-a[i,3]>ans then ans:=now-a[i,3];
>   end;
>   writeln(ans);
> end.
>
>
> What is goin` wrong???

~~~~~~~~~
i forgot :
if now<a[i,1] then
  now:=a[i,1]
!!!!
thx! i've got AC!
Posted by Bobur 26 Mar 2008 23:04