测评机: Virmain[1]
得分: 90分
有效耗时: 177毫秒
测试结果1: 测试结果正确
测试结果2: 测试结果正确
测试结果3: 测试结果正确
测试结果4: 测试结果正确
测试结果5: 测试结果正确
测试结果6: 测试结果正确
测试结果7: 测试结果正确
测试结果8: 无输出|运行超时
测试结果9: 测试结果正确
测试结果10: 测试结果正确
我的程序:
program pp;
var
b:array[1..1000] of boolean;
f:array[1..1000,1..1000] of boolean;
d:array[1..1000] of integer;
n,all:integer;
procedure init;
var
i,j,m,p:integer;
begin
read(n);
for i:=1 to n do
begin
read(m);
for j:=1 to m do
begin
read(p);
f[i,p]:=true;
end;
end;
if n=0 then
begin
write(0);
halt;
end;
end;
function find(p:integer):boolean;
var
i:integer;
begin
for i:=1 to n do if (not f[p,i])and(not b[i]) then
begin
b[i]:=true;
if (d[i]=0)or(find(d[i])) then
begin
d[i]:=p;
exit(true);
end;
end;
exit(false);
end;
procedure main;
var
i:integer;
begin
for i:=1 to n do
begin
fillchar(b,sizeof(b),false);
if find(i) then inc(all);;
end;
write(all);
end;
begin
init;
main;
end.
难道我编错了?
请大牛帮忙指出,谢谢.
增加一个超级源S,使S与X集里所有顶点相连,容量为1. 增加一个超级辉T,使T与Y集里所有顶点相连,容量为1.若X集与Y集的某些顶点有相连,那么容量为1.这时候,一个网络的模型就展现在我们的眼前.接下来最大流算法即可.