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 1203. Scientific Conference

What is a problem? (+)
Posted by Andrey Popyk (popyk@ief.tup.km.ua) 12 Jun 2002 12:56
Maybe I don't understand the problem.
I think, that problem is to find a maximum number of noncrossing
intervals.
But Sorting and this program too, cannot give ACCEPTED.
Only WA :-)

Andrey Popyk.
popyk@ief.tup.km.ua
ICQ# 88914410

VAR A:Array[1..30000] of integer;
    N,Ts,Te,Res,Curr,i:integer;
BEGIN
  for i:=1 to 30000 do A[i]:=30001;
  readln(N);
  for i:=1 to N do
  begin
    readln(Ts,Te);
    if A[Ts]>Te then A[Ts]:=Te;
  end;
  Res:=0; Curr:=1;
  while Curr<=30000 do
  begin
    if A[Curr]=30001 then inc(Curr)
                     else begin Curr:=A[Curr]+1; inc(Res) end;
  end;
  writeln(Res);
END.
Re: What is a problem? (+)
Posted by Miguel Angel 13 Jun 2002 03:45
>   Res:=0; Curr:=1;
>   while Curr<=30000 do
>   begin
>     if A[Curr]=30001 then inc(Curr)
>                      else begin Curr:=A[Curr]+1; inc(Res) end;
>   end;
>   writeln(Res);
> END.
For example, if you have A[1] = 29998 and A[29999] = 30000, Res will
be equal 2 at end, but you may have a lot of segments betwen 1 and
29998. Try to do it in another way:). Email me if you still have
problems. miguelangelhdz@hotmail.com
Good Luck and thks for Euler algorithm :)
Oh my God! :-)
Posted by Andrey Popyk (popyk@ief.tup.km.ua) 13 Jun 2002 12:52
Thanks.
Now I know where is my mistake. It is in my head :)