Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
WHY WA?program poj1274; var map:array[0..205,0..205] of boolean; match:array[0..205] of integer; v:array[0..205] of boolean; i,j,n,m,ans,k,p:longint; function find(s:integer):boolean; var i:integer; begin find:=false; for i:=1 to m do if map[s,i] then if not v[i] then begin v[i]:=true; if (match[i]=0) or find(match[i]) then begin match[i]:=s; exit(true); end; end; exit(false); end; begin while not eof do begin fillchar(match,sizeof(match),0); fillchar(map,sizeof(map),0); readln(n,m); for i:=1 to n do begin read(k); for j:=1 to k do begin read(p); map[i,p]:=true; end; end; ans:=0; for i:=1 to n do begin fillchar(v,sizeof(v),false); if find(i) then inc(ans); end; writeln(ans); end; end. Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator