var n,m,i,j:longint; ans:int64; sel,lx,ly,slack:..] of int64; a:..,..] of int64; visx,visy:..] of boolean; function dfs(po:longint):boolean; var i:longint; t:int64; begin visx[po]:=true; to m do if visy[i]=false then begin t:=lx[po]+ly[i]-a[po,i]; th…