|
|
вернуться в форум(wa5) give me wrong test. PLEASE. 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. Послано Kit 17 авг 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/ 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/ you algo wrong. You need use DP. i got AC O(N^2/2) |
|
|