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#10?
Posted by evjava 19 Nov 2009 22:21
program Project2;
{$APPTYPE CONSOLE}
uses
  SysUtils;
type
  tt = record
    t1, t2, t3: integer;
  end;
var
  i, n, time, tek: integer;
  a: array[1..50] of tt;
begin
  readln(n);
  for i := 1 to n do
    readln(a[i].t1, a[i].t2, a[i].t3);

{  sort(1, n);}
//....a[1].t1<a[2].t1<.....<a[n].t1
  time := 0;
  tek := 0;
  for i := 1 to n do
  begin
    if tek >= a[i].t1 then
      tek := tek + a[i].t2
    else
      tek := a[i].t1 + a[i].t2;
    if tek > a[i].t3 then
    begin
      time :=time+ tek - a[i].t3;
      tek := a[i].t3;
    end
  end;
  writeln(time);
end.
Why WA#10?
Posted by [SESC USU] Zhirov Eugene 4 Dec 2009 22:04
I don't understand too.
Have tried many test... And it works correctly.
Help please by giving test =).
Re: Why WA#10?
Posted by Susan Arr (RAU) 27 Dec 2010 22:08
Try this
3
100 10 120
70 40 150
99 15 100

The answer is 25.
Re: Why WA#10?
Posted by VolkovStanislav[MSU_Tashkent] 8 Aug 2011 23:52


Edited by author 09.08.2011 01:40
Re: Why WA#10?
Posted by Astekinane 22 Sep 2011 20:57
Why? I think it 35:

0 min:
1:100 10 120
2:70 40 150
3:99 15 100
Q{}

70 min:
1:30 10 120
3:29 15 100
Q{2(40)}

70+29 min:
1:1 10 120
Q{2(11),3(15)}

70+29+1 min:
Q(2(10),3(15),1(10)}

fin:100+10+15+10 min;
Third student doesn't fit into 35 minutes.

SURE!!!!
Posted by daminus 1 Mar 2012 15:38
Oh, that's true!!! Thanks!!
Re: Why WA#10?
Posted by Levan Khunjgurua[Tbilisi SU] 29 Apr 2014 02:31
So? Extra time

for the second one is 0
for the third is 25
for the first it is - 15

Shift = 40. Why is it incorrect?


Algorithm - sort by T1 - results 2,3,1
Total time for the second student to accomplish = 110
110 > 99 so, here goes the third ready student 110+15=125. 125 - 100 = 25
Total time = 125.
125 > 100 so, here goes the first ready student 125+10=135. 135 - 120= 15

So the total shift is 40 minutes.

What's wrong? :/