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

Обсуждение задачи 1029. Министерство

Got WrongAnswer at #6
Послано James Xie 11 апр 2008 10:33
if you have got WA at #6,you could Answer me
Re: Got WrongAnswer at #6
Послано simon 11 июл 2008 19:27
I have the same problem
Re: Got WrongAnswer at #6
Послано Madhan G 28 июл 2008 15:33
i too got WA6, any corner case which we are missing?
Re: Got WrongAnswer at #6
Послано ZeleninAA 10 апр 2009 16:35
I've got WA 6. What's wrong in my program?

Var
    fee,r:array[1..500,1..100] of qword;
   dir:array[1..500,1..100] of (DUp,DLeft,DRight);
   floor,floors,room,rooms,minroom:integer;

Begin
   {$IFNDEF ONLINE_JUDGE}
   assign(input,'input.txt');
   reset(input);
   assign(output,'output.txt');
   rewrite(output);
   {$ENDIF}

   readln(floors,rooms);

   for floor:=1 to floors do begin
       for room:=1 to rooms do
          read(fee[floor,room]);
      readln;
   end;

   for room:=1 to rooms do
       r[floors,room]:=fee[floors,room];

   for floor:=floors-1 downto 1 do begin
       {primary fill}
       for room:=1 to rooms do begin
          r[floor,room]:=fee[floor,room]+r[floor+1,room];
         dir[floor,room]:=DUp;
      end;
      {form left to right}
      for room:=2 to rooms do
          if fee[floor,room]+r[floor,room-1] < r[floor,room] then begin
             r[floor,room]:=fee[floor,room]+r[floor,room-1];
            dir[floor,room]:=DLeft;
         end;
      {from right to left}
      for room:=rooms-1 downto 1 do
          if fee[floor,room]+r[floor,room+1] < r[floor,room] then begin
             r[floor,room]:=fee[floor,room]+r[floor,room+1];
            dir[floor,room]:=DRight;
         end;
   end;

   minroom:=1;
   for room:=2 to rooms do
       if r[1,room] < r[1,minroom] then minroom:=room;

   room:=minroom;
   floor:=1;
   write(room,' ');
   while floor<floors do begin
      case dir[floor,room] of
          DUp:Inc(floor);
         DLeft:Dec(room);
         DRight:Inc(Room);
      end;
      write(room,' ');
   end;

   {$IFNDEF ONLINE_JUDGE}
   close(input);
   close(output);
   {$ENDIF}

end.
Re: Got WrongAnswer at #6
Послано remdy21 3 авг 2009 12:22
I also WA6