ENG  RUS Timus Online Judge
Online Judge
Problems
Authors
Online contests
Site news
Webboard
Problem set
Submit solution
Judge status
Guide
Register
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;
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
You should use DP.
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))