ENG  RUSTimus Online Judge
Online Judge
Задачи
Авторы
Соревнования
О системе
Часто задаваемые вопросы
Новости сайта
Форум
Ссылки
Архив задач
Отправить на проверку
Состояние проверки
Руководство
Регистрация
Исправить данные
Рейтинг авторов
Текущее соревнование
Расписание
Прошедшие соревнования
Правила
вернуться в форум

Обсуждение задачи 1193. Очередь на зачёт

Why WA#10?
Послано evjava 19 ноя 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?
Послано [SESC USU] Zhirov Eugene 4 дек 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?
Послано Susan Arr (RAU) 27 дек 2010 22:08
Try this
3
100 10 120
70 40 150
99 15 100

The answer is 25.
Re: Why WA#10?
Послано VolkovStanislav[MSU_Tashkent] 8 авг 2011 23:52


Edited by author 09.08.2011 01:40
Re: Why WA#10?
Послано Astekinane 22 сен 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!!!!
Послано daminus 1 мар 2012 15:38
Oh, that's true!!! Thanks!!
Re: Why WA#10?
Послано Levan Khunjgurua[Tbilisi SU] 29 апр 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? :/