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

Обсуждение задачи 1019. Перекрашивание прямой

NOooooo!!!
Послано Ural_Banyan Tree 23 дек 2002 15:52
What's wrong with my program?
Is there any difference between Delphi and pascal?
yes
Послано I am david. Tabo. 23 дек 2002 19:27
> What's wrong with my program?
> Is there any difference between Delphi and pascal?
yes. post your program
Послано I am david. Tabo. 23 дек 2002 19:27
> What's wrong with my program?
> Is there any difference between Delphi and pascal?
Re: yes. post your program
Послано Ural_Banyan Tree 18 янв 2003 17:13
program t1019;
const q=8000;
var  w:array[0..q,1..2]of longint;
     way,max,i,j,k,n,a,b,l1,r1,p,temp:longint;
     c,d:char;
     t,l,r:boolean;
begin
     readln(n);
     fillchar(w,sizeof(w),0);
     w[1,1]:=1; w[1,2]:=1000000000;
     k:=1;
     j:=0;
     max:=0;
     repeat
           read(a,b,c);
           if c=' ' then read(c);
           t:=false;
           l:=false; r:=false;
           if a<>b then begin
           if c='b' then
              begin
              for i:=1 to k do
                  begin
                       t:=true;
                       if (w[i,1]>=a)and(w[i,2]<=b) then for p:=i to
k do
                          begin w[i,1]:=w[i+1,1]; w[i,2]:=w[i+1,2];
dec(k); end;
                       if w[i,1]=a then w[i,1]:=b;
                       if w[i,2]=b then w[i,2]:=a;
                       if (w[i,1]<a)and(w[i,2]>b) then
                          begin
                          inc(k);
                          w[k,2]:=w[i,2];
                          w[i,2]:=a;
                          w[k,1]:=b;
                          end;
                       if (w[i,1]<a)and(w[i,2]<=b)and(w[i,2]>a)then w
[i,2]:=a;
                       if (w[i,1]>=a)and(w[i,1]<b)and(w[i,2]>b)then w
[i,1]:=b;
                  end;
              end;
           if c='w' then
              for i:=1 to k do
                  begin
                      if (w[i,1]>a)and(w[i,2]>b)and(b>=w[i,1])
                         then begin w[i,1]:=a; t:=true; l:=true; l1:=w
[i,2];end;
                      if (w[i,1]<a)and(a<=w[i,2])and(b>w[i,2])
                         then begin w[i,2]:=b; t:=true; r:=true; r1:=w
[i,1]; end;
                      if (w[i,1]>a)and(w[i,2]<b)then
                         begin w[i,1]:=a; w[i,2]:=b; t:=true; end;
                      if (w[i,1]<a)and(w[i,2]>b)then t:=true;
                  end;
                  if (l)and(r) then
                     begin
                     inc(k);
                     w[k,1]:=r1;
                     w[k,2]:=l1;
                     end;
                  if t=false then
                         begin
                         inc(k);
                         w[k,1]:=a;
                         w[k,2]:=b;
                         end;
                  end;
           inc(j);
     until j>=n;
     way:=0;
     for i:=1 to k do if w[i,2]-w[i,1]+1>max then
         begin
              way:=i;
              max:=w[i,2]-w[i,1]+1;
         end;
     if way=0 then begin writeln(0); halt; end
              else writeln(w[way,1],' ',w[way,2]);
     readln;
     readln;
end.
I'm sorry I post my program so late
Послано Ural_Banyan Tree 26 янв 2003 18:59