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

WHY WA WHATS WRONG HELP
Posted by Oleg 13 Jan 2003 16:41
var i,j,k,n,m:integer;
    cur,sh : longint;
    a,b,c:array [0..100] of integer;
begin
 read(n);
 for i:=1 to n do read(a[i],b[i],c[i]);
 for i:=1 to n do
  for j:=i+1 to n do
   if a[i]>a[j] then
   begin
    a[0]:=a[i];a[i]:=a[j];a[j]:=a[0];
    b[0]:=b[i];b[i]:=b[j];b[j]:=b[0];
    c[0]:=c[i];c[i]:=c[j];c[j]:=c[0];
   end;
 cur := a[1];
 sh:=0;
 for i := 1 to n do
 begin
  cur := cur+b[i];
  j:=cur-c[i];
  if j>sh then sh:=j;
 end;
 writeln(sh);
end.
I GOT AC DONT WAIST YOUR TIME
Posted by Oleg 13 Jan 2003 16:48
> var i,j,k,n,m:integer;
>     cur,sh : longint;
>     a,b,c:array [0..100] of integer;
> begin
>  read(n);
>  for i:=1 to n do read(a[i],b[i],c[i]);
>  for i:=1 to n do
>   for j:=i+1 to n do
>    if a[i]>a[j] then
>    begin
>     a[0]:=a[i];a[i]:=a[j];a[j]:=a[0];
>     b[0]:=b[i];b[i]:=b[j];b[j]:=b[0];
>     c[0]:=c[i];c[i]:=c[j];c[j]:=c[0];
>    end;
>  cur := a[1];
>  sh:=0;
>  for i := 1 to n do
>  begin
>   cur := cur+b[i];
>   j:=cur-c[i];
>   if j>sh then sh:=j;
>  end;
>  writeln(sh);
> end.
>
So Help ME OLEG
Posted by Locomotive 13 Jan 2003 18:07
SO Cna you explain the example for me better and tell me better about
1193?
i can`t undertand what should we do 4 it?
aidin_n7@hotmail.com
post your code and i will help you
Posted by Oleg 13 Jan 2003 18:38
Re: post your code and i will help you
Posted by Locomotive 13 Jan 2003 18:41
>
> Hi Hi hi oleg
thanks for your quick answer!!!
My code is like yours
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.

Help Me
And if you cna tell me your mail address for more conversation and
helps!
Aidin_n7@hotmail.com is mine.
Re: post your code and i will help you
Posted by Locomotive 13 Jan 2003 19:00
Thanks Olag
i GOt AC
no need to your help for this problem!
Special thanks for you previous comments on webboard
Aidin