function main():longint;
begin
noden:=n;
rest:=dat;
pathn:=0;
path[0]:=1;
h[1]:=true;
DFS();
main:=ans;
end;
function DFS():integer;
var
i:integer;
begin
if path[pathn]=noden then
exit(core());
for i:=1 to noden do
if not h[i] and (rest[path[pathn],i]>0) then
begin
h[i]:=true;
inc(pathn);
path[pathn]:=i;
re:=DFS();
dec(pathn);
h[i]:=false;
if (re<>0) and (re<>pathn) then
exit(re);
end;
DFS:=0;
end;
function core():integer;
var
i:integer;
min:longint;
begin
core:=0;
for i:=2 to pathn do
if rest[path[i-1],path[i]]<rest[path[core],path[core+1]] then
core:=i-1;
min:=rest[path[core],path[core+1]];
for i:=1 to pathn do
begin
dec(rest[path[i-1],path[i]],min);
inc(rest[path[i],path[i-1]],min);
end;
inc(ans,min);
end;
知道偶写滴系虾米滴同学帮下忙~~~~帮偶看下哪里错了~~~~~T_T~~~~大部分数据系可以过滴说~~~~
偶还是去写***flow好了~~~~=。=