讨论 / 最后一个点不过....求解
qbqwer 2011-11-07 01:01:00
点我顶贴 收藏 删除
var a:array[1..400,1..400] of boolean;

link:array[1..400] of integer;

v:array[1..400] of boolean;

tot, i,j,k,l,n,m:integer;

function find(x:integer):boolean;

var i,j,k:integer;

begin

for i:=1 to n do

if a[x,i] then

if not v[i] then

begin

v[i]:=true;

if (link[i]=0) or (find(i)) then

begin

link[i]:=x;

exit(true);

end;

end;

exit(false);

end;

begin

readln(n,m);

for i:=1 to n do

begin

read(k);

for j:=1 to k do

begin

read(l);

a[i+m,l]:=true;

a[l,i+m]:=true;

end;

end;

n:=n+m;

for i:=1 to n do

begin

fillchar(v,sizeof(v),0);

if find(i) then inc(tot);

end;

writeln(tot div 2);

end.

测试结果1: 通过本测试点|有效耗时156ms

测试结果2: 通过本测试点|有效耗时157ms

测试结果3: 通过本测试点|有效耗时47ms

测试结果4: 通过本测试点|有效耗时46ms

测试结果5: 通过本测试点|有效耗时47ms

测试结果6: 通过本测试点|有效耗时172ms

测试结果7: 通过本测试点|有效耗时172ms

测试结果8: 通过本测试点|有效耗时172ms

测试结果9: 通过本测试点|有效耗时172ms

测试结果10: 测试结果错误.错误结果为:200

正确结果应为:100

#1 ptwuyuhuai@2011-11-07 01:01:00
回复 删除
我最后一个点输出的是300……
查看更多回复
提交回复