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 1273. Tie

Виктор Крупко (wa5) give me wrong test. PLEASE. [5] // Problem 1273. Tie 17 Aug 2005 00:05
    var
 x,y:array[1..100] of integer;
 b:array[1..100] of boolean;
 i,n,otv:integer; ex:boolean;
procedure reflesh;
    var
    i,max,col,j,yd:integer;
begin
   ex:=false;
   for i:=1 to n do
   if b[i] then
   begin
   col:=0;
   for j:=1 to n do
   if (i<>j) and b[j] then
   begin
   if (x[i]=y[i]) then break;
   if (x[i]<y[i]) then
   if ((x[j]>x[i]) and (y[i]>y[j])) then begin inc(col); yd:=j; end;
   if (x[i]>y[i]) then
   if ((x[i]>x[j]) and (y[i]<y[j])) then begin inc(col); yd:=j; end;
   end;
   if col=1 then begin  inc(otv); b[yd]:=false; ex:=true; break; end;
   end;
end;
begin
{   assign(input,'c:\test.txt');
   reset(input);}
   ex:=true;
   readln(n);
   fillchar(b,sizeof(b),true);
   for i:=1 to n do readln(x[i],y[i]);
   while ex do reflesh;
   writeln(otv);
end.
Kit Re: (wa5) give me wrong test. PLEASE. [4] // Problem 1273. Tie 17 Aug 2005 12:21
Try this
3
1 5
2 3
3 4
The right answer - 1.
You should use DP.
Виктор Крупко I have lost your address of mail/ [3] // Problem 1273. Tie 18 Aug 2005 06:13
I am very weak in the theory.
My algorithm not true.
Whether you can give me idea. (my mail xxvictorxx@mail.ru (if has overlooked))
Tolstobrov_Anatoliy[Ivanovo SPU] Re: I have lost your address of mail/ [2] // Problem 1273. Tie 20 Aug 2005 13:01

you algo wrong.

You need use DP.
i got AC O(N^2/2)
+FAMAS+ MALADEZ [1] // Problem 1273. Tie 20 Aug 2005 15:00
Tolstobrov_Anatoliy[Ivanovo SPU] Re: MALADEZ // Problem 1273. Tie 21 Aug 2005 21:39

SURE?