PersonalCorpus 版 (精华区)
寄信人: sino (蚱蜢舟)
标 题: 1078
发信站: 哈工大紫丁香 (2002年03月23日12:47:57 星期六)
来 源: mtlab4.hit.edu.cn
171179 04:50:52 23 Mar 2002
Bozhang,HIT,P.R.China 1078 Pascal Accepted 0.11 sec 303K
var
pp:array[1..499,1..2] of integer;
dl:array[1..499,1..499] of boolean;
sum,contain:array[1..499] of word;
used:array[1..499] of boolean;
f:boolean;
i,j,n:integer;
begin
readln(n); for i:=1 to n do readln(pp[i,1],pp[i,2]);
for i:=1 to n do for j:=1 to n do
if (pp[i,1]<pp[j,1]) and (pp[j,2]<pp[i,2]) then dl[i,j]:=true else d
l[i,j]:=false;
fillchar(sum,sizeof(sum),0);
fillchar(contain,sizeof(contain),0);
fillchar(used,sizeof(used),255);
f:=true;
while f do begin
f:=false;
for i:=1 to n do if used[i] then begin
f:=true;
for j:=1 to n do if used[j] then if dl[i,j] then begin
f:=false; break;
end;
if f then begin
used[i]:=false;
for j:=1 to n do if used[j] then
if dl[j,i] then if sum[i]+1>sum[j] then begin
sum[j]:=sum[i]+1;
contain[j]:=i;
end;
break;
end;
end;
end;
j:=1; for i:=2 to n do if sum[i]>sum[j] then j:=i;
i:=0;
while j<>0 do begin
inc(i); sum[i]:=j; j:=contain[j];
end;
writeln(i);
for j:=i downto 1 do write(sum[j],' ');writeln;
end.
--
FreeBSD has a large number of afficionados who are prepared to flame
anybody who dares suggest that it's not better than Linux.
Linux has a large number of afficionados who are prepared to flame
anybody who dares suggest that it's not better than FreeBSD.
※ 来源:·哈工大紫丁香 bbs.hit.edu.cn·[FROM: mtlab4.hit.edu.cn]
Powered by KBS BBS 2.0 (http://dev.kcn.cn)
页面执行时间:3.036毫秒