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

Help me please! I got WA # 9
Posted by SanKeaR 28 Aug 2008 23:36
This is my code:

var n,i,j,max,k:integer;
t1,t2,t3:array[1..101] of integer;
begin
read(n);
k:=0;
for i:=1 to n do read(t1[i],t2[i],t3[i]);
for i:=1 to n do
for j:=n downto i+1 do
if t1[i]>t1[j] then
begin
k:=t1[i];
t1[i]:=t1[j];
t1[j]:=k;
k:=t2[i];
t2[i]:=t2[j];
t2[j]:=k;
k:=t3[i];
t3[i]:=t3[j];
t3[j]:=k;
end;
k:=t1[1];
max:=0;
j:=0;
for i:=1 to n do
begin
inc(k,t2[i]);
if k>t3[i] then j:=k-t3[i];
if j>max then max:=j;
end;
write(max);
end.

Sorry for Russian...
Помогите мне пожалуйста, буду очень благодарен!!!

Edited by author 28.08.2008 23:40
Re: Help me please! I got WA # 9
Posted by [LG]_#\#@P$T[101]R 29 Aug 2008 00:31
You code is wrong! use queue and got AC! ;)