Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

Re:WHY WA?

Posted by chenhongbin at 2009-09-05 12:29:43 on Problem 1274
In Reply To:WHY WA? Posted by:black_snow at 2009-09-03 21:51:05
> 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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator