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.
Posted by Виктор Крупко 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.
Re: (wa5) give me wrong test. PLEASE.
Posted by Kit 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/
Posted by Виктор Крупко 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))
Re: I have lost your address of mail/
Posted by Tolstobrov_Anatoliy[Ivanovo SPU] 20 Aug 2005 13:01

you algo wrong.

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

SURE?